web_socket.c File : web_socket.c
Description : Provides a Simplified Threaded Server
Category : Web Internal
Author : Charles Yates
SOCKET_Init WEB_SOCKET SOCKET_Init( int port, WEB_COMMON common )
Function : SOCKET_Init
Description : Initialises a Socket Server
Input : int port - port to listen on
WEB_COMMON common - common block
Output : void
Returns : WEB_SOCKET - an initialised but inactive socket server
SOCKET_GetCommon WEB_COMMON SOCKET_GetCommon( WEB_SOCKET sock )
Function : SOCKET_GetCommon
Description : Returns the common structure
Input : WEB_SOCKET - socket to use
Output : void
Returns : WEB_COMMON - Address of common structure
SOCKET_Start int SOCKET_Start( WEB_SOCKET sock, void *func( void * ) )
Function : SOCKET_Start
Description : Activates the socket server thread
Input : WEB_SOCKET - socket to use
void *func() - handling function
Output : The socket server thread is activated
Returns : int - 0 = success, != 0 when unsuccessful
SOCKET_Wait int SOCKET_Wait( WEB_SOCKET sock )
Function : SOCKET_Wait
Description : Waits for the socket to terminate
Input : WEB_SOCKET - socket to use
Output : void
Returns : int - 0 = success, != 0 when unsuccessful
SOCKET_Accept int SOCKET_Accept( WEB_SOCKET sock )
Function : SOCKET_Accept
Description : Blocks the calling process until a socket request is made
Input : WEB_SOCKET - socket to use
Output : void
Returns : int - file descriptor of incoming socket
SOCKET_Close void SOCKET_Close( WEB_SOCKET sock )
Function : SOCKET_Close
Description : Closes the server and frees the assoicated memory
Input : WEB_SOCKET - socket to use
Output : Socket is closed and memory is freed
Returns : void
|