|
LRAUV
revA
|
Implements a Socket client for communicating with SocketServer instances. More...
#include <SocketClient.h>


Public Member Functions | |
| SocketClient (const char *host, int port) throw ( SocketException ) | |
| SocketClient (const char *host, int port, int timeoutMillis) throw ( SocketException ) | |
| Connection with timeout. More... | |
| virtual | ~SocketClient () |
Public Member Functions inherited from Socket | |
| virtual | ~Socket () |
| int | send (const char *buffer, size_t bufferLength) const throw ( SocketException& ) |
| If return value is -1, check errno. More... | |
| int | sendall (const char *buffer, size_t bufferLength) |
| Like send but making sure the whole requested buffer is sent out. More... | |
| int | recv (char *buffer, size_t bufferLength) const throw ( SocketException& ) |
| Blocking read. More... | |
| int | recv (char *buffer, size_t bufferLength, int timeoutMillis) throw ( SocketException& ) |
| Socket read with timeout. More... | |
| int | setTimeout (const int milliseconds) |
| int | close () |
| int | getPort () |
| int | getDescriptor () |
| exposes the socket descriptor to facilitate direct operations More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Socket | |
| Socket () | |
| void | create () throw ( SocketException& ) |
| void | bind (const int port) throw ( SocketException& ) |
| void | listen () const throw ( SocketException& ) |
| void | accept (Socket &newSocket) throw ( SocketException& ) |
| void | accept (Socket &newSocket, int timeoutMillis) throw ( SocketException& ) |
| accept with given timeout, which could be 0 for completely non-blocking behavior More... | |
| void | connect (const char *host, const int port) throw ( SocketException& ) |
| void | connect (const char *host, const int port, int timeoutMillis) throw ( SocketException& ) |
| connect with timeout. More... | |
| void | setNonBlocking (const bool nonBlocking) throw ( SocketException& ) |
| bool | isValid () const |
| void | setTimeval (const int milliseconds, struct timeval &tv) |
Implements a Socket client for communicating with SocketServer instances.
| SocketClient::SocketClient | ( | const char * | host, |
| int | port | ||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
References Socket::connect(), and Socket::create().
| SocketClient::SocketClient | ( | const char * | host, |
| int | port, | ||
| int | timeoutMillis | ||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
Connection with timeout.
According to man connect, the implementation is based on the following sequence of system calls as needed:
The timeout parameter is used in the select system call.
| host | |
| port | |
| timeoutMillis | Timeout in millis. A value of 100 or more has worked well according to testing with client on testhyssim and server on bufflehead. |
| SocketException | If some error occurs. In particular, the thrown exception will have getErrno() == EAGAIN if one of the following occurs:
|
References Socket::connect(), and Socket::create().
|
inlinevirtual |