This class implements all methods specific to TCP sockets.
|
| | cSocketTCP () |
| | Constructor of cSocketTCP.
|
| |
| | cSocketTCP (int socket) |
| | Constructor of cSocketTCP using an already opened socket.
|
| |
| virtual | ~cSocketTCP () |
| | Destructor of cSocketTCP.
|
| |
| int | connect (const char *a_address, unsigned short a_port, bool a_block=true, double a_timeout=-1.0) |
| | This method connects to a remote server.
|
| |
| int | listen (unsigned short a_port, bool a_block=true, bool a_loopback=false) |
| | This method listens for incoming client connections.
|
| |
| cSocketTCP * | accept (bool a_block=true, double a_timeout=-1.0) |
| | This method accepts connections from incoming client connection requests.
|
| |
| unsigned char | getAttributes () |
| | This method retrieves the socket attributes.
|
| |
| int | setAttributes (unsigned char a_attributes) |
| | This method sets the socket attributes.
|
| |
| | cSocket () |
| |
| | cSocket (int a_socket) |
| |
| virtual | ~cSocket () |
| |
| int | getLocalPort () |
| | This method returns the local port number that the socket is connected to.
|
| |
| std::string | getRemoteIP () |
| | This method retrieves the remote IP address that the socket is connected to.
|
| |
| int | getRemotePort () |
| | This method returns the remote port number that the socket is connected to.
|
| |
| int | close () |
| | This method closes the socket.
|
| |
| int | peek (char *a_output, unsigned int a_size) |
| | This method reads a copy of incoming data (without removing the data).
|
| |
| int | peek (std::string &a_output) |
| | This method reads a copy of incoming data (without removing the data).
|
| |
| int | read (char *a_output, unsigned int a_size) |
| | This method reads a incoming data.
|
| |
| int | read (std::string &a_output) |
| | This method reads a incoming data.
|
| |
| int | readLine (char *a_output, unsigned int a_size) |
| | This method reads an entire line of data (delimited by the '\n' character).
|
| |
| int | readLine (std::string &a_output) |
| | This method reads an entire line of data (delimited by the '\n' character).
|
| |
| int | send (const char *a_data, int a_length) |
| | This method sends data through the socket.
|
| |
| int | send (std::string a_data) |
| | This method sends data through the socket.
|
| |
| double | getTimeout () |
| | This method retrieves the socket timeout in (s).
|
| |
| int | setTimeout (double a_timeout) |
| | This method sets the socket timeout in (s).
|
| |
| int | getSendSize () |
| | This method retrieves the socket outgoing buffer size.
|
| |
| int | setSendSize (int a_size) |
| | This method sets the socket outgoing buffer size.
|
| |
| int | getRecvSize () |
| | This method retrieves the socket incoming buffer size.
|
| |
| int | setRecvSize (int a_size) |
| | This method sets the socket incoming buffer size.
|
| |
|
| static std::string | getLocalIP () |
| | This method retrieves the local IP address.
|
| |
| static const unsigned int | BUFFERSIZE = 2048 |
| | This constant defines the default outgoing and incoming socket buffer sizes.
|
| |
| static const unsigned char | BLOCKING = 0x01 |
| | This constant defines the attribute bit to hold the socket BLOCKING attribute.
|
| |
| static const unsigned char | REUSEADDR = 0x02 |
| | This constant defines the attribute bit to hold the socket REUSEADDR attribute.
|
| |
| static const unsigned char | NODELAY = 0x04 |
| | This constant defines the attribute bit to hold the socket NODELAY attribute.
|
| |
| static const unsigned char | DEFAULT_ATTR = 0x00 | BLOCKING | REUSEADDR | ~NODELAY |
| | This constant defines the default attributes for new sockets.
|
| |
| static const int | WOULDBLOCK = -2 |
| | This return constant is used to signify that a non-blocking socket would block.
|
| |
| static const int | SHORTLINE = -3 |
| | This return constant is used to signify that a buffer is too small to hold a line.
|
| |
| static const int | TIMEOUT = -4 |
| | This return constant is used to signify that a read operation on a socket has timed out.
|
| |
| unsigned char | getBaseAttributes () |
| | This method retrieves the socket attributes shared between TCP and UDP.
|
| |
| int | setBaseAttributes (unsigned char a_attributes) |
| | This method sets the socket attributes shared between TCP and UDP.
|
| |
| int | m_socket |
| | Unique socket identifier.
|
| |
| unsigned char | m_attributes |
| | Socket attributes.
|
| |
| char | m_buffer [BUFFERSIZE] |
| | Socket read buffer.
|
| |
| unsigned long | m_remoteIP |
| | Socket remote IP address.
|
| |
| unsigned int | m_remotePort |
| | Socket remote port number.
|
| |
| unsigned long | m_localIP |
| | Socket local IP address.
|
| |
| unsigned int | m_localPort |
| | Socket local port number.
|
| |