Socket Class Reference

Class that manage the connection with the server. More...

#include <socket.h>

List of all members.

Public Member Functions

 Socket ()
 Constructor.
 ~Socket ()
 Destructor.
bool sendStr (string)
 Send a string to the server.
bool closeSock ()
 Close the socket.
bool connectSock (int, string, string)
 Connect the socket to the server.
bool getState ()
 Get connection state.
string receive ()
 Receive a string from the server.

Private Attributes

bool state
 Socket state.
int mySock
 Socket handle.


Detailed Description

Class that manage the connection with the server.

This class manage the connection with the irc server. It uses a socket for communication

Definition at line 53 of file socket.h.


Constructor & Destructor Documentation

Socket::Socket (  ) 

Constructor.

Class constructor

Definition at line 34 of file socket.cpp.

References mySock, and state.

Socket::~Socket (  ) 

Destructor.

Clas destructor

Definition at line 43 of file socket.cpp.

References closeSock().


Member Function Documentation

bool Socket::closeSock (  ) 

Close the socket.

Close the socket

Returns:
true if socket well closed, else false

Definition at line 95 of file socket.cpp.

References mySock, and state.

Referenced by receive(), BotKernel::reconnect(), BotKernel::run(), and ~Socket().

bool Socket::connectSock ( int  port,
string  serverName,
string  dedicatedIP 
)

Connect the socket to the server.

Connect the socket to a server The socket can be "block type" and use a dedicated IP adress

Parameters:
port Server port
serverName Server IP or hostname
dedicatedIP Dedicated IP used for connextion. Empty if not used
Returns:
True if connection OK, else false

Definition at line 56 of file socket.cpp.

References mySock, and state.

Referenced by BotKernel::connect(), danstonchat(), planet(), tele(), trad(), and wiki().

bool Socket::getState (  ) 

Get connection state.

Get connection state

Returns:
true if the socket is connected, else false

Definition at line 110 of file socket.cpp.

References state.

Referenced by BotKernel::run().

string Socket::receive (  ) 

Receive a string from the server.

Receive a string from the server

Returns:
Received string? Empty if nothing received

Definition at line 119 of file socket.cpp.

References closeSock(), mySock, and state.

Referenced by danstonchat(), planet(), BotKernel::run(), tele(), trad(), and wiki().

bool Socket::sendStr ( string  strData  ) 

Send a string to the server.

Send a string to the server

Parameters:
strData String to send
Returns:
true if send OK, else false

Definition at line 153 of file socket.cpp.

References mySock.

Referenced by danstonchat(), planet(), BotKernel::send(), tele(), trad(), and wiki().


Member Data Documentation

int Socket::mySock [private]

Socket handle.

Definition at line 74 of file socket.h.

Referenced by closeSock(), connectSock(), receive(), sendStr(), and Socket().

bool Socket::state [private]

Socket state.

Definition at line 72 of file socket.h.

Referenced by closeSock(), connectSock(), getState(), receive(), and Socket().


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

Generated on Sun Aug 16 15:28:57 2009 for trustyRC by  doxygen 1.5.8