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

clawsoft.ServerSocket Class Reference

#include <ServerSocket.h>

Inheritance diagram for clawsoft.ServerSocket:

Inheritance graph
[legend]
Collaboration diagram for clawsoft.ServerSocket:

Collaboration graph
[legend]

Detailed Description

This class handles the socket server interface.

Definition at line 12 of file ServerSocket.h.

Public Methods

 ServerSocket (const int pport, const int m=256)
 This constructor takes as an argument the port where to listen requests and the size of the backlog.

virtual ~ServerSocket ()
 Destroys the server socket closing connection to every client connected.

virtual Socketaccept ()
 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.


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.


Constructor & Destructor Documentation

clawsoft.ServerSocket::ServerSocket const int    pport,
const int    m = 256
 

This constructor takes as an argument the port where to listen requests and the size of the backlog.

Definition at line 22 of file ServerSocket.cpp.

References clawsoft.ServerSocket.CreateSocket(), and clawsoft.Object.setClassName().

virtual clawsoft.ServerSocket.~ServerSocket   [inline, virtual]
 

Destroys the server socket closing connection to every client connected.

Definition at line 27 of file ServerSocket.h.

References clawsoft.ServerSocket.close().


Member Function Documentation

Socket * clawsoft.ServerSocket::accept   [virtual]
 

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 Server.start().

void clawsoft.ServerSocket::close   [virtual]
 

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]
 

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]
 

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.

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.


Field Documentation

int clawsoft.ServerSocket.maxConn [protected]
 

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().


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

Powered by:

SourceForge Logo