TCP/IP server socket. More...
Public Member Functions | |
ServerSocket () | |
Creates a new server socket. More... | |
virtual Socket * | accept () |
Accepts a new connection request and returns the corresponding socket. More... | |
virtual int | bind (int port, int backlog=50) |
Assigns the socket to the local address. More... | |
virtual int | close () |
Closes the socket. | |
bool | isClosed () const |
Returns true if the socket has been closed. | |
int | descriptor () |
Returns the Unix 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 server socket.
This class implements a TCP/IP socket that waits for requests to come in over the network. AF_INET connections following the IPv4 Internet protocol are supported.
ccuty::ServerSocket::ServerSocket | ( | ) |
Creates a new server socket.
Creates a listening socket that waits for connection requests by TCP/IP clients.
|
virtual |
Accepts a new connection request and returns the corresponding socket.
By default, this function blocks the caller until a connection is present.
|
virtual |
Assigns the socket to the local address.
The socket must be bound before using it.