Functions

connection.h File Reference

Header for the connection-handling module. More...

Go to the source code of this file.

Functions

int initConnectionHandler (void)
 Initializes the connection-handling module.
int handleConnection (int clientSock, int listenSock)
 Handles an incoming connection.

Detailed Description

Header for the connection-handling module.


Function Documentation

int handleConnection ( int  clientSock,
int  listenSock 
)

Handles an incoming connection.

This function should be called from the main module whenever a new connection has been accepted.

Parameters:
clientSock Socket representing the accepted connection from the client. Upon completing the request or as soon as it is no longer needed, this socket is closed.
listenSock Socket the server is listening on. This socket must be closed in any child process that may be launched.
Returns:
0 on success, -1 on error.
int initConnectionHandler ( void   ) 

Initializes the connection-handling module.

Note:
This function must be invoked after parseArgs().
Returns:
0 on success, -1 on error.
 All Files Functions