Rudiments
|
Inherits clientsocket, and unixsocketutil.
Public Member Functions | |
unixclientsocket () | |
unixclientsocket (const unixclientsocket &u) | |
unixclientsocket & | operator= (const unixclientsocket &u) |
virtual | ~unixclientsocket () |
int32_t | connect (const char *filename, long timeoutsec, long timeoutusec, unsigned long retrywait, unsigned long retrycount) |
void | initialize (constnamevaluepairs *cd) |
void | initialize (const char *filename, long timeoutsec, long timeoutusec, unsigned long retrywait, unsigned long retrycount) |
int32_t | connect () |
The unixclientsocket class allows you to write programs that can talk to other programs on the same machine over TCP stream sockets.
Inet sockets (see the inetclientsocket class) can be used by clients and servers on the same machine as well, but Unix sockets generally perform better.
The unixclientsocket class provides methods for connecting to servers. Its ultimate parent class: filedescriptor provides methods for reading and writing data and closing connections.
unixclientsocket::unixclientsocket | ( | ) |
Creates an instance of the unixclientsocket class.
unixclientsocket::unixclientsocket | ( | const unixclientsocket & | u | ) |
Creates an instance of the unixclientsocket class. that is a copy of "u".
virtual unixclientsocket::~unixclientsocket | ( | ) | [virtual] |
Deletes this instance of unixclientsocket.
int32_t unixclientsocket::connect | ( | ) | [virtual] |
Attempts to connect to the "filename" set earlier. If the connection fails, it will retry "retrycount" times, waiting "retrywait" seconds between tries.
Setting "retrycount" to 0 will cause it to try to connect indefinitely. Setting "retrywait" to 0 will cause it to try to connect over and over as fast as possible (not recommended).
Each attempt to connect will wait "timeoutsec" seconds and "timeoutusec" microseconds for the connect to succeed. Specifying -1 for either parameter will cause the attempt to wait until the underlying protocol times out which may be up to 2 minutes.
Returns RESULT_SUCCESS on success and RESULT_ERROR on failure.
Implements client.
void unixclientsocket::initialize | ( | const char * | filename, |
long | timeoutsec, | ||
long | timeoutusec, | ||
unsigned long | retrywait, | ||
unsigned long | retrycount | ||
) |
Initializes the class to use "filename", "timeoutsec", "timeoutusec", "retrywait" and "retrycount" when connect() is called.
void unixclientsocket::initialize | ( | constnamevaluepairs * | cd | ) | [virtual] |
unixclientsocket& unixclientsocket::operator= | ( | const unixclientsocket & | u | ) |
Makes this instance of the unixclientsocket class identical to "u".