Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

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.


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 TCPsocket getSocket ()
 Returns the socket's file descriptor value.

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

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


Static Public Methods

int installedCPUs ()
 This will return how many CPUs are installed in the system.

double cpuSpeed ()
 This will return the CPU speed in megahertz.

int totalMemory ()
 Will return the total amount of system memory.

int freeMemory ()
 Will return the total amount of free system memory.

void usleep (Uint32 usec)
 Will freeze the software for usec microseconds.


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.

void setClassName (const char *n)
 Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.


Protected Attributes

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

TCPsocket tcpsock
 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.

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

Destroys the server socket closing connection to every client connected.


Member Function Documentation

Socket * clawsoft::ServerSocket::accept   [virtual]
 

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

void clawsoft::ServerSocket::close   [virtual]
 

Closes communication to all clients and shuts down the socket.

double clawsoft::System::cpuSpeed   [static, inherited]
 

This will return the CPU speed in megahertz.

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

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

int clawsoft::System::freeMemory   [static, inherited]
 

Will return the total amount of free system memory.

const char * clawsoft::Object::getClassName   [inherited]
 

Returns the name of the current class.

const int clawsoft::ServerSocket::getPort   [inline]
 

Returns the port number where the server socket was bounded.

const TCPsocket clawsoft::SocketBase::getSocket   [inline, inherited]
 

Returns the socket's file descriptor value.

int clawsoft::System::installedCPUs   [static, inherited]
 

This will return how many CPUs are installed in the system.

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

Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

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

Is an interface to setsockopt.

int clawsoft::SocketBase::setSoTimeout int    [inherited]
 

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

int clawsoft::System::totalMemory   [static, inherited]
 

Will return the total amount of system memory.

void clawsoft::System::usleep Uint32    usec [static, inherited]
 

Will freeze the software for usec microseconds.


Field Documentation

int clawsoft::ServerSocket::maxConn [protected]
 

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

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.

TCPsocket clawsoft::SocketBase::tcpsock [protected, inherited]
 

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


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

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo