Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

KServerSocket.h File Reference

Server sockets management functions. More...

#include "ktypes.h"
#include "KSocket.h"

Typedefs

typedef _KServerSocket KServerSocket
 KServerSocket structure.
typedef void( kfunc_ss_newsocket )(KPtr)
 The functions called at server connexion.

Enumerations

enum  ESSRet {
  KSS_RET_UNKNOWN_ERROR, KSS_RET_SUCCESS, KSS_RET_BAD_PARAMETERS, KSS_RET_NO_WAIT_CONNEXION,
  KSS_RET_ALREADY_LISTENING
}
 Return codes. More...

Functions

KTL_API KServerSocketKServerSocket_new ()
 Allocates a KServerSocket structure.
KTL_API void KServerSocket_delete (KServerSocket **pServer)
 Deletes a KServerSocket structure.
KTL_API ESSRet KServerSocket_setMaxConnexion (KServerSocket *pServer, KUInt16 iMaxConn)
 Defines the maximum number of connexion.
KTL_API ESSRet KServerSocket_listen (KServerSocket *pServer, KUInt16 iPort)
 Starts the listening of the connexion on a given port. This function is nonblocking.
KTL_API ESSRet KServerSocket_stopListening (KServerSocket *pServer)
 Stops the listening of connexions.
KTL_API KBool KServerSocket_isListening (KServerSocket *pServer)
 Indicates if a socket is in listening mode.
KTL_API ESSRet KServerSocket_accept (KServerSocket *pServer, KSocket **pSocket)
 Accepts a server connexion. Removes the demand of the connexion list and allows a new connexion request. This is a nonblocking function.
KTL_API ESSRet KServerSocket_setFuncNewSocket (KServerSocket *pServer, kfunc_ss_newsocket *fNewSocket, KPtr pUserData)
 Defines a function called at each accepted connexion.


Detailed Description

Server sockets management functions.

Version:
KToolLib-1.0
Author:
Fabien Gallot
Date:
31/07/2009
Note:
Copyright © 2008-2010 iKlax Media SAS (www.iklaxmedia.com). All rights reserved.

Typedef Documentation

typedef void( kfunc_ss_newsocket)(KPtr)
 

The functions called at server connexion.

Parameters:
?? 


Enumeration Type Documentation

enum ESSRet
 

Return codes.

Enumeration values:
KSS_RET_UNKNOWN_ERROR  Unknown error.
KSS_RET_SUCCESS  Successful.
KSS_RET_BAD_PARAMETERS  Bad parameters.
KSS_RET_NO_WAIT_CONNEXION  No wait connexion.
KSS_RET_ALREADY_LISTENING  Socket already listening.


Function Documentation

KTL_API ESSRet KServerSocket_accept KServerSocket pServer,
KSocket **  pSocket
 

Accepts a server connexion. Removes the demand of the connexion list and allows a new connexion request. This is a nonblocking function.

Parameters:
pServer the pointer to the KServerSocket structure
pSocket the pointers to the KSocket structure. If a connexion request is waiting then this structure should be correctly initilized otherwise knull
Returns:
an ESSRet code

KTL_API void KServerSocket_delete KServerSocket **  pServer  ) 
 

Deletes a KServerSocket structure.

Parameters:
pServer the pointers to the KServerSocket structure to be deleted

KTL_API KBool KServerSocket_isListening KServerSocket pServer  ) 
 

Indicates if a socket is in listening mode.

Parameters:
pServer the pointer to the KServerSocket structure
Returns:
ktrue if the socket is in listening mode otherwise kfalse

KTL_API ESSRet KServerSocket_listen KServerSocket pServer,
KUInt16  iPort
 

Starts the listening of the connexion on a given port. This function is nonblocking.

Parameters:
pServer the pointer to the KServerSocket structure
iPort the server listening port
Returns:
an ESSRet code

KTL_API KServerSocket* KServerSocket_new  ) 
 

Allocates a KServerSocket structure.

Returns:
the pointer to the KServerSocket structure correctly initialized if successful otherwise knull

KTL_API ESSRet KServerSocket_setFuncNewSocket KServerSocket pServer,
kfunc_ss_newsocket fNewSocket,
KPtr  pUserData
 

Defines a function called at each accepted connexion.

Parameters:
pServer the pointer to the KServerSocket structure
fNewSocket the pointer to the function called at socket connexion
pUserData the pointer to data given as parameter of the fNewSocket function
Returns:
an ESSRet code

KTL_API ESSRet KServerSocket_setMaxConnexion KServerSocket pServer,
KUInt16  iMaxConn
 

Defines the maximum number of connexion.

Parameters:
pServer the pointer to the KServerSocket structure
iMaxConn an integral number that defines the maximum number of connexion
Returns:
an ESSRet code

KTL_API ESSRet KServerSocket_stopListening KServerSocket pServer  ) 
 

Stops the listening of connexions.

Parameters:
pServer the pointer to the KServerSocket structure
Returns:
an ESSRet code


Generated on Tue Mar 9 10:49:30 2010 for iKlax Tools Library (KToolLib) by doxygen 1.3.8