SocketUN Class Reference

Socket Unix handling class. More...

#include <SocketUN.hh>

List of all members.

Public Member Functions

 SocketUN (SignalHandlerType theType=stSignalInterrupt)
 Does not open the socket, see Init methods.
 ~SocketUN ()
 Close the socket.
int connectUN (pid_t Server_pid)
 Called by client to connect.
void acceptUN (int RTIA_port)
 Called by server to open the socket and wait for the connection.
bool isDataReady ()
int returnSocket ()
void send (const unsigned char *, size_t) throw (NetworkError, NetworkSignal)
 send Message using Socket UNIX.
void receive (const unsigned char *, size_t) throw (NetworkError, NetworkSignal)

Protected Member Functions

void error (const char *) throw (NetworkError)
 error.

Protected Attributes

int _socket_un
bool _est_serveur
bool _est_init_un
SignalHandlerType HandlerType
std::string name

Private Attributes

Socket::ByteCount_t SentBytesCount
Socket::ByteCount_t RcvdBytesCount
int sock_connect
pdCDebugpD


Detailed Description

Socket Unix handling class.

On windows platform this socket class is implemented using a TCP socket since Unix socket are not available. IMPORTANT NOTE: This UNIX socket implementation uses a Read Buffer to improve global read performances(by reducing Read system calls). An important drawback of this improvement is that a socket can be marked as empty for the system, but in fact there is data waiting in the read buffer. This is especially a problem for processes using the 'select' system call: the socket won't be marked as ready for reading, because all data has already been read, and is waiting in the internal buffer. Therefore, before returning to a select loop, be sure to call the IsDataReady method to check whether any data is waiting for processing.

Definition at line 62 of file SocketUN.hh.


Constructor & Destructor Documentation

SocketUN ( SignalHandlerType  theType = stSignalInterrupt  ) 

Does not open the socket, see Init methods.

Definition at line 252 of file SocketUN.cc.

References PrettyDebug::Out(), SocketUN::pD, and pdInit.

Here is the call graph for this function:

~SocketUN (  ) 


Member Function Documentation

int connectUN ( pid_t  Server_pid  ) 

Called by client to connect.

Definition at line 164 of file SocketUN.cc.

References MAX_ATTEMPTS, NOM_FICHIER_SOCKET, pdError, and pdInit.

Referenced by RTI::RTIambassador::RTIambassador().

void acceptUN ( int  RTIA_port  ) 

Called by server to open the socket and wait for the connection.

Definition at line 55 of file SocketUN.cc.

References SocketUN::_est_init_un, SocketUN::_est_serveur, SocketUN::_socket_un, SocketUN::error(), SocketUN::name, NOM_FICHIER_SOCKET, PrettyDebug::Out(), SocketUN::pD, pdError, pdInit, and SocketUN::sock_connect.

Referenced by Communications::Communications().

Here is the call graph for this function:

bool isDataReady (  ) 

Indicates whether any data as already been read from the system socket and is waiting in the internal buffer

Definition at line 381 of file SocketUN.cc.

Referenced by Communications::readMessage().

int returnSocket (  ) 

Definition at line 396 of file SocketUN.cc.

References SocketUN::_socket_un.

Referenced by Communications::readMessage().

void send ( const unsigned char *  buffer,
size_t  size 
) throw (NetworkError, NetworkSignal)

send Message using Socket UNIX.

Parameters:
buffer buffer to send
size buffer size

Definition at line 307 of file SocketUN.cc.

References SocketUN::_est_init_un, SocketUN::_socket_un, SocketUN::HandlerType, PrettyDebug::Out(), SocketUN::pD, pdExcept, pdTrace, SocketUN::SentBytesCount, and certi::stSignalInterrupt.

Here is the call graph for this function:

void receive ( const unsigned char *  buffer,
size_t  Size 
) throw (NetworkError, NetworkSignal)

void error ( const char *  msg  )  throw (NetworkError) [protected]

error.

Definition at line 365 of file SocketUN.cc.

Referenced by SocketUN::acceptUN().


Member Data Documentation

int _socket_un [protected]

bool _est_serveur [protected]

Definition at line 95 of file SocketUN.hh.

Referenced by SocketUN::acceptUN(), and SocketUN::~SocketUN().

bool _est_init_un [protected]

Definition at line 98 of file SocketUN.hh.

Referenced by SocketUN::receive(), and SocketUN::send().

std::string name [protected]

Definition at line 100 of file SocketUN.hh.

Referenced by SocketUN::acceptUN(), and SocketUN::~SocketUN().

Definition at line 104 of file SocketUN.hh.

Referenced by SocketUN::send(), and SocketUN::~SocketUN().

Definition at line 105 of file SocketUN.hh.

Referenced by SocketUN::receive(), and SocketUN::~SocketUN().

int sock_connect [private]

Definition at line 108 of file SocketUN.hh.

Referenced by SocketUN::acceptUN(), and SocketUN::~SocketUN().

pdCDebug* pD [private]


The documentation for this class was generated from the following files:

Generated on Thu Apr 30 15:58:46 2009 for CERTIDeveloperDocumentation by doxygen 1.5.5