Main Page   Packages   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

Server Class Reference

#include <Server.h>

Inheritance diagram for Server:

Inheritance graph
[legend]
Collaboration diagram for Server:

Collaboration graph
[legend]

Detailed Description

This class implements server socket which attends petitions from the clients, turning each petition in a thread.

Definition at line 13 of file Server.h.

Public Methods

 Server (int port)
bool init ()
int start (int argc, char *argv[])
bool cleanup ()
virtual Socket * accept ()
 Waits for a client to connect from a remote host returning it's client socket.

virtual void close ()
 Closes communication to all clients and shuts down the socket.

const int getPort ()
 Returns the port number where the server socket was bounded.

const int getSocket ()
 Returns the socket's file descriptor value.

int setSoTimeout (int)
 Defines the timeout before closing connection to the other end of communication.

char * getClassName ()
 Returns the name of the current class.


Static Public Methods

void takeDown ()

Protected Methods

int CreateSocket (const int theport, const int m=256)
 This method binds a server socket to the port specified by theport.

int setSockOption (int opname, void *optval, unsigned int siz)
 Is an interface to setsockopt.

int setTCPOption (int opname, void *optval, unsigned int siz)
void setClassName (char *n)
 Call this method when you need to set the name of the class you're creating, typically int it's constructor, remeber that you must set the classname for every clas you create, that way you can have more information while being in a debuging process.


Protected Attributes

int maxConn
 Stores the value of the backlog parameter for the listen(2) system call.

int sock
 This file descriptor represents the socket itself as returned by socket(2) and accept(2).

int port
 Defines the communications port used by the socket or the port which the socket server uses to listen requests.


Static Protected Attributes

SharedVar< int > stayUp


Constructor & Destructor Documentation

Server::Server int    port
 

Definition at line 18 of file Server.cpp.


Member Function Documentation

Socket * clawsoft.ServerSocket::accept   [virtual, inherited]
 

Waits for a client to connect from a remote host returning it's client socket.

Definition at line 79 of file ServerSocket.cpp.

References clawsoft.ServerSocket.maxConn, clawsoft.SocketBase.port, and clawsoft.SocketBase.sock.

Referenced by start().

bool Server::cleanup  
 

Definition at line 46 of file Server.cpp.

References counter.

Referenced by main().

void clawsoft.ServerSocket::close   [virtual, inherited]
 

Closes communication to all clients and shuts down the socket.

Definition at line 103 of file ServerSocket.cpp.

References clawsoft.SocketBase.sock.

Referenced by clawsoft.ServerSocket.~ServerSocket().

int clawsoft.ServerSocket::CreateSocket const int    theport,
const int    m = 256
[protected, inherited]
 

This method binds a server socket to the port specified by theport.

Definition at line 27 of file ServerSocket.cpp.

References clawsoft.addSigpipeHandler(), clawsoft.ServerSocket.maxConn, clawsoft.SocketBase.port, and clawsoft.SocketBase.sock.

Referenced by clawsoft.ServerSocket.ServerSocket().

char * clawsoft.Object::getClassName   [inherited]
 

Returns the name of the current class.

Definition at line 18 of file Object.cpp.

References clawsoft.Object.__cls_name.

const int clawsoft.ServerSocket.getPort   [inline, inherited]
 

Returns the port number where the server socket was bounded.

Definition at line 36 of file ServerSocket.h.

References clawsoft.SocketBase.port.

const int clawsoft.SocketBase.getSocket   [inline, inherited]
 

Returns the socket's file descriptor value.

Definition at line 38 of file SocketBase.h.

References clawsoft.SocketBase.sock.

bool Server::init  
 

Definition at line 20 of file Server.cpp.

References clawsoft.genCards().

Referenced by main().

void clawsoft.Object::setClassName char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically int it's constructor, remeber that you must set the classname for every clas you create, that way you can have more information while being in a debuging process.

Definition at line 14 of file Object.cpp.

References clawsoft.Object.__cls_name.

Referenced by clawsoft.ArrayOutOfBoundsException.ArrayOutOfBoundsException(), clawsoft.BrokenPipeException.BrokenPipeException(), clawsoft.Dialog.CancelButton.CancelButton(), clawsoft.CantLoadDSOException.CantLoadDSOException(), clawsoft.CantUnloadDSOException.CantUnloadDSOException(), clawsoft.ConnectionRefusedException.ConnectionRefusedException(), clawsoft.ConnectionTimeoutException.ConnectionTimeoutException(), clawsoft.Dialog.Dialog(), clawsoft.DSOException.DSOException(), clawsoft.DSOSymbolException.DSOSymbolException(), clawsoft.ElementNotFoundException.ElementNotFoundException(), clawsoft.Font.Font(), clawsoft.GameSelector.GameSelector(), clawsoft.Dialog.HelpButton.HelpButton(), clawsoft.IOException.IOException(), clawsoft.KeyboardEvent.KeyboardEvent(), clawsoft.LoginDialog.LoginDialog(), clawsoft.Mutex.Mutex(), clawsoft.MutexException.MutexException(), clawsoft.NetworkException.NetworkException(), clawsoft.NetworkUnreachableException.NetworkUnreachableException(), clawsoft.NoMoreTokensException.NoMoreTokensException(), clawsoft.NullPointerException.NullPointerException(), clawsoft.NumberException.NumberException(), clawsoft.Object.Object(), clawsoft.Dialog.OKButton.OKButton(), clawsoft.Plugin.Plugin(), clawsoft.ProcOutOfFileDescriptorsException.ProcOutOfFileDescriptorsException(), Random.Random(), clawsoft.ServerSocket.ServerSocket(), clawsoft.Socket.Socket(), clawsoft.SocketAlreadyBoundedException.SocketAlreadyBoundedException(), clawsoft.SocketAlreadyUsedException.SocketAlreadyUsedException(), clawsoft.SocketUnableToReadException.SocketUnableToReadException(), clawsoft.SocketUnableToWriteException.SocketUnableToWriteException(), clawsoft.SysOutOfFileDescriptorsException.SysOutOfFileDescriptorsException(), clawsoft.TextBox.TextBox(), clawsoft.TextButton.TextButton(), clawsoft.TextField.TextField(), clawsoft.Thread.Thread(), clawsoft.UnableToLockMutexException.UnableToLockMutexException(), clawsoft.UnableToUnlockMutexException.UnableToUnlockMutexException(), and clawsoft.Window.Window().

int clawsoft.SocketBase::setSockOption int    opname,
void *    optval,
unsigned int    siz
[protected, inherited]
 

Is an interface to setsockopt.

Definition at line 13 of file SocketBase.cpp.

References clawsoft.SocketBase.sock.

Referenced by clawsoft.SocketBase.setSoTimeout().

int clawsoft.SocketBase::setSoTimeout int    [inherited]
 

Defines the timeout before closing connection to the other end of communication.

Definition at line 28 of file SocketBase.cpp.

References clawsoft.SocketBase.setSockOption().

int clawsoft.SocketBase::setTCPOption int    opname,
void *    optval,
unsigned int    siz
[protected, inherited]
 

Definition at line 23 of file SocketBase.cpp.

int Server::start int    argc,
char *    argv[]
 

Definition at line 27 of file Server.cpp.

References clawsoft.ServerSocket.accept(), counter, clawsoft.Thread.start(), and stayUp.

Referenced by main().

void Server::takeDown   [static]
 

Definition at line 12 of file Server.cpp.

References stayUp.


Field Documentation

int clawsoft.ServerSocket.maxConn [protected, inherited]
 

Stores the value of the backlog parameter for the listen(2) system call.

Definition at line 20 of file ServerSocket.h.

Referenced by clawsoft.ServerSocket.accept(), and clawsoft.ServerSocket.CreateSocket().

int clawsoft.SocketBase.port [protected, inherited]
 

Defines the communications port used by the socket or the port which the socket server uses to listen requests.

Definition at line 27 of file SocketBase.h.

Referenced by clawsoft.ServerSocket.accept(), clawsoft.Socket.CreateSocket(), clawsoft.ServerSocket.CreateSocket(), clawsoft.Socket.getPort(), clawsoft.ServerSocket.getPort(), clawsoft.Socket.operator=(), and clawsoft.Socket.Socket().

int clawsoft.SocketBase.sock [protected, inherited]
 

This file descriptor represents the socket itself as returned by socket(2) and accept(2).

Definition at line 22 of file SocketBase.h.

Referenced by clawsoft.ServerSocket.accept(), clawsoft.Socket.close(), clawsoft.ServerSocket.close(), clawsoft.Socket.CreateSocket(), clawsoft.ServerSocket.CreateSocket(), clawsoft.SocketBase.getSocket(), clawsoft.Socket.operator=(), clawsoft.Socket.operator>>(), clawsoft.Socket.read(), clawsoft.SocketBase.setSockOption(), clawsoft.Socket.Socket(), and clawsoft.Socket.write().

SharedVar< int > Server::stayUp [static, protected]
 

Referenced by start(), and takeDown().


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

Powered by:

SourceForge Logo