A wrapper around sys/socket.h for tcp communications between Socket instances – use daughter classes SocketClient or SocketServer to do any real work.
More...
#include <Socket.h>
|
| 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...
|
| |
|
| | 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) |
| |
A wrapper around sys/socket.h for tcp communications between Socket instances – use daughter classes SocketClient or SocketServer to do any real work.
accept with given timeout, which could be 0 for completely non-blocking behavior
| void Socket::connect |
( |
const char * |
host, |
|
|
const int |
port |
|
) |
| |
| throw | ( | SocketException & |
| ) | | |
|
protected |
| void Socket::connect |
( |
const char * |
host, |
|
|
const int |
port, |
|
|
int |
timeoutMillis |
|
) |
| |
| throw | ( | SocketException & |
| ) | | |
|
protected |
| int Socket::getDescriptor |
( |
| ) |
|
|
inline |
| bool Socket::isValid |
( |
| ) |
const |
|
inlineprotected |
| int Socket::recv |
( |
char * |
buffer, |
|
|
size_t |
bufferLength |
|
) |
| const |
| throw | ( | SocketException & |
| ) | | |
| int Socket::recv |
( |
char * |
buffer, |
|
|
size_t |
bufferLength, |
|
|
int |
timeoutMillis |
|
) |
| |
| throw | ( | SocketException & |
| ) | | |
Socket read with timeout.
If return value is -1, check errno.
NOTE: assumes the socket is in blocking mode: it sets it to non-blocking for the internal operation, and sets it back to blocking before returning.
| int Socket::send |
( |
const char * |
buffer, |
|
|
size_t |
bufferLength |
|
) |
| const |
| throw | ( | SocketException & |
| ) | | |
| int Socket::sendall |
( |
const char * |
buffer, |
|
|
size_t |
bufferLength |
|
) |
| |
| void Socket::setNonBlocking |
( |
const bool |
nonBlocking | ) |
|
| throw | ( | SocketException & |
| ) | | |
|
protected |
| int Socket::setTimeout |
( |
const int |
milliseconds | ) |
|
| void Socket::setTimeval |
( |
const int |
milliseconds, |
|
|
struct timeval & |
tv |
|
) |
| |
|
protected |
| sockaddr_in Socket::addr_ |
|
private |
The documentation for this class was generated from the following files:
- /Volumes/ubuntu_share/lrauv-application/Source/io/Socket.h
- /Volumes/ubuntu_share/lrauv-application/Source/io/Socket.cpp