|Accepting a connection was delayed (no connection present). |
|Connection has been successfully accepted. |
|There was an error accepting a connection. |
|int||acceptConnection (int serverSock, int timeout, int *status)|
|Internal function which implements non-blocking waiting for a connection. |
|int||makeSimpleServSock (const unsigned short port)|
|This function will initialize a simple TCP server listening on a port on all available interfaces. |
|int||makeSimpleClientSock (const char *servName, const unsigned short port)|
|This function will initialize a simple TCP socket which can be used to act as a TCP client. |
|int||hasData (int sock, struct timeval *timeout)|
Those network functions are intended to abstract some some processes in TCP/IP communication and by doing so save the other modules from beeing cluttered with net communications details.
Definition in file netfunctions.h.
|#define ACCEPTSTAT_DELAYED 0|
|#define ACCEPTSTAT_ERROR -1|
|#define ACCEPTSTAT_OK 1|
Internal function which implements non-blocking waiting for a connection.
We cannot afford a blocking accept(), because we would miss a quit request.
|serverSock||A listening server socket from which we get the connection.|
|timeout||Timeout (in seconds) which to wait for a connection|
|status||Status of the new connection. Can be one of # ACCEPTSTAT_DELAYED - so far no connection has been made # ACCEPTSTAT_OK - new connection has been successfully established # ACCEPTSTAT_ERROR - there was an error|
|struct timeval *||timeout|
|int makeSimpleClientSock||(||const char *||servName,|
|const unsigned short||port|
This function will initialize a simple TCP socket which can be used to act as a TCP client.
No binding will be done. In case of error use perror() to get a message.
|servName||Name of the server we want to connect to, not it's address (in particular: anything what gethostbyname() will accept.|
|port||port address to connect to|
|int makeSimpleServSock||(||const unsigned short||port||)|
This function will initialize a simple TCP server listening on a port on all available interfaces.
In case of error use perror() to get a message.
|port||The TCP port to listen on|