Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

FD::network_socket Class Reference

#include <SocketStream.h>

Inheritance diagram for FD::network_socket:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 network_socket (int type, int port)
 ~network_socket ()
 Destructor, will terminate connexion calling shutdown().
void printOn (std::ostream &out) const
void init_broadcast ()
 Init broadcast communication.
size_t send_packet (unsigned char *packet, size_t size)
size_t recv_packet (unsigned char *packet, size_t size)
void shutdown ()
 Shutdown network socket (will end communication).
void socket_connect (const char *host)
void socket_listen (int backlog, bool blocking)
void socket_accept ()
int get_type ()
int get_port ()
int get_read_socket ()
int get_write_socket ()
int get_listen_socket ()

Static Public Attributes

static const int BROADCAST_TYPE
 Broadcast type on the subnet (mask = 255.255.255.0).
static const int TCP_STREAM_TYPE
 TCP stream standard communication type.

Detailed Description

Base class for network sockets. The class supports two types of communication : BROADCAST_TYPE and TCP_STREAM_TYPE. According to the type of communication, the user will have to use socket_connect(...) for TCP_STREAM_TYPE (client), and socket_listen(...), socket_accept(...) for TCP_STREAM_TYPE (server). For the BROADCAST_TYPE, the user don't have to use these functions. I/O is performed using send_packet(...) and recv_packet(...).

Author:
Dominic Letourneau
Date:
03/10/2001


Constructor & Destructor Documentation

FD::network_socket::network_socket int  type,
int  port
 

Constructor with type and port params.

Parameters:
type The type of socket : BROADCAST_TYPE or TCP_STREAM_TYPE
port The network port


Member Function Documentation

int FD::network_socket::get_listen_socket  )  [inline]
 

Return the listen socket

Returns:
int m_listen_socket

int FD::network_socket::get_port  )  [inline]
 

Return the port of the socket.

Returns:
int m_port

int FD::network_socket::get_read_socket  )  [inline]
 

Return the read socket

Returns:
int m_read_socket

int FD::network_socket::get_type  )  [inline]
 

Returns the type of socket.

Returns:
int m_type

int FD::network_socket::get_write_socket  )  [inline]
 

Return the write socket

Returns:
int m_write_socket

void FD::network_socket::printOn std::ostream &  out  )  const
 

Useful for IStream and OStream (deriving for Object)
Format : <network_socket Type m_type Port m_port >

size_t FD::network_socket::recv_packet unsigned char *  packet,
size_t  size
 

Read data from the network socket.

Parameters:
packet Byte pointer to the data to receive.
packet Max size of the receiver buffer.

size_t FD::network_socket::send_packet unsigned char *  packet,
size_t  size
 

Send data on the network socket.

Parameters:
packet Byte pointer to the data to send.
size the number of bytes to send

void FD::network_socket::socket_accept  ) 
 

Accept from a socket (server), listen must have been done before.

void FD::network_socket::socket_connect const char *  host  ) 
 

Connect to a host name.

Parameters:
host host name

void FD::network_socket::socket_listen int  backlog,
bool  blocking
 

Listen to a socket (server)

Parameters:
backlog Number of "listen" to do.
blocking Blocking on "listen" ?


The documentation for this class was generated from the following file:
Generated on Wed Oct 5 14:29:50 2005 for FlowDesigner by  doxygen 1.4.4