Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Ishtar::NetworkServer Class Reference

#include <network.h>

List of all members.


Detailed Description

A server that listen on a TCP/IP host. User code subclass should inherits from NetworkServer and implement incomingData, incomingConnection and ocnnectionClosed.


Public Member Functions

 NetworkServer (UInt16 port)
 Constructor. Create server socket that listen on port.
virtual ~NetworkServer ()
 Destructor, close connections and destroy server socket.
void run (void)
 Run and return only on SIGTERM.
void step (bool block=false, long timeout=0)
 Read server and client sockets from incoming connection or datas and call incomingConnection or incomingData. If block is true, wait until any data arrives. If block is false, wait timeout us at maximum.

Protected Member Functions

virtual void incomingData (Socket *socket)=0
 Called when datas from client are available on socket. If socket is closed in this method, connectionClosed is called. Must be implemented by subclass.
virtual void incomingConnection (Socket *socket)=0
 Called when a new connection has been established on socket. If socket is closed in this method, connectionClosed is not called. Must be implemented by subclass.
virtual void connectionClosed (Socket *socket)=0
 Called when connection to client is closed on socket. Must be implemented by subclass.

Private Member Functions

void closeSocket (Socket *s)
 Close client socket s and remove client from list.

Private Attributes

SocketserverSocket
 The server socket on which we listen.
std::list< Socket * > clients
 The list of connected clients.


The documentation for this class was generated from the following files:
Generated on Mon Oct 24 17:30:54 2005 for libishtarnet by  doxygen 1.4.2