TCP/IP IPv4 server socket. More...
Public Member Functions | |
GNatServerSocket () | |
Creates a listening socket that waits for connection requests by TCP/IP clients. | |
GNatSocket * | accept () |
Accepts a new connection request and returns a socket for exchanging data with this client. More... | |
int | bind (int port, int backlog=50) |
Assigns the server socket to localhost. More... | |
int | close () |
Closes the socket. | |
bool | isClosed () const |
Returns true if the socket was closed. | |
SOCKET | descriptor () |
Returns the descriptor of the socket. | |
int | setReceiveBufferSize (int size) |
Sets the SO_RCVBUF option to the specified value. | |
int | setReuseAddress (bool) |
Enables/disables the SO_REUSEADDR socket option. | |
int | setSoTimeout (int timeout) |
Enables/disables SO_TIMEOUT with the specified timeout (in milliseconds). | |
int | setTcpNoDelay (bool) |
Turns on/off TCP coalescence (useful in some cases to avoid delays). | |
TCP/IP IPv4 server socket.
Waits for requests to come in over the network. TCP/IP sockets do not preserve record boundaries but SocketBuffer solves this problem.
GNatSocket * GNatServerSocket::accept | ( | ) |
Accepts a new connection request and returns a socket for exchanging data with this client.
This function blocks until there is a connection request.
int GNatServerSocket::bind | ( | int | port, |
int | backlog = 50 |
||
) |
Assigns the server socket to localhost.