zeus::TServerSocket Class Reference

#include <ServerSocket.h>

Inheritance diagram for zeus::TServerSocket:

zeus::TAbstractSocket zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TServerSocket (const TString &rstrAddr, Uint uiPort)
 TServerSocket (TIPAddress &rAddress)
virtual Retval bind (bool bDynamicBinding=false)
virtual Retval accept (TSocket *&rpClient)
virtual Retval acceptTO (TSocket *&rpClient, Float fTimeOut)
virtual Retval connect ()
bool isBound () const

Protected Member Functions

virtual ~TServerSocket ()


Detailed Description

A server socket waits for incomming connections from clients. It simply accepts or declines incomming connection requests. If accepted the server object will return a client socket which is connected with the client.

Constructor & Destructor Documentation

TServerSocket::TServerSocket ( const TString rstrAddr,
Uint  uiPort 
)

Creates a Server Socket

Parameters:
rstrAddr : address or name of the server
uiPort : Listening port

TServerSocket::TServerSocket ( TIPAddress rAddress  ) 

Creates a Server Socket

Parameters:
rAddress : address of the server

TServerSocket::~TServerSocket (  )  [protected, virtual]

Destroys a Server Socket


Member Function Documentation

Retval TServerSocket::bind ( bool  bDynamicBinding = false  )  [virtual]

Creats a valid server socket descripitor and binds the server to the port of the network interface

Parameters:
bDynamicBinding : Binds dynamicaly to a unused port if this flag is set. Default is static binding.
Returns:
see TAbstractSocket::getErrorCode()

Retval TServerSocket::accept ( TSocket *&  rpClient  )  [virtual]

Accepts a incomming connection to a client socket. The Socket will be wrapped into a TSocket Object. This method blocks the calling thread unitl a client connects to this server socket. For non blocking server sockets this method will return imediately.

Note:
If the server socket is used in a child thread of the applications its important that the socket is non blocking, otherwise the thread will hang.
Parameters:
rpClient : return parameter of the client
Returns:
see TAbstractSocket::getErrorCode()

Retval TServerSocket::acceptTO ( TSocket *&  rpClient,
Float  fTimeOut 
) [virtual]

Same as the accept() method, but with a timeout. The time is only effective if the socket is non blocking. To use non blocking call setBlockable(false). For blocking server sockets this method is identical to accept().

Parameters:
rpClient : return parameter of the client
fTimeOut : The time out in seconds
Returns:
see TAbstractSocket::getErrorCode()

virtual Retval zeus::TServerSocket::connect (  )  [inline, virtual]

Implements zeus::TAbstractSocket.

bool zeus::TServerSocket::isBound (  )  const [inline]

Checks if the server socket is bound to an address. This returns the same as the isConnected() method, in the understanding that the server is connected to its local socket.


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


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Wed Oct 28 21:42:33 2009