guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
Public Member Functions | List of all members
GNatServerSocket Class Reference

TCP/IP IPv4 server socket. More...

Public Member Functions

 GNatServerSocket ()
 Creates a listening socket that waits for connection requests by TCP/IP clients.
 
GNatSocketaccept ()
 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).
 

Detailed Description

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.

Member Function Documentation

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.

Returns
the new Socket or nullptr on error.
int GNatServerSocket::bind ( int  port,
int  backlog = 50 
)

Assigns the server socket to localhost.

Returns
0 on success or a negative value on error, see Socket::Errors

The documentation for this class was generated from the following files: