Socket Class Reference

Class that implements a TCP client socket. More...

#include <socket.h>

Collaboration diagram for Socket:
Collaboration graph
[legend]

Public Member Functions

 Socket (iNetClass &netclass, bool wait_on_connect=false, bool blocking=false)
 Constructor.
 ~Socket ()
 Destructor.
void Connect (const wxString &addr, const int port)
 Connect to remote host.
void Disconnect ()
 Disconnect from remote host if connected.
bool Send (const wxString &data)
 Send data over connection.
wxString Receive ()
 Receive data from connection.
wxString ReceiveSpecial ()
 used in plasmaservice, otherwise getting garbeld responses
wxString GetLocalAddress () const
 used to retrieve local ip address behind NAT to communicate to the server on login
wxString GetHandle ()
SockState State ()
 Get curent socket state.
SockError Error () const
 Get socket error code.
void SetSendRateLimit (int Bps=-1)
 Set the maximum upload ratio.
int GetSendRateLimit ()
void OnTimer (int mselapsed)
void SetTimeout (const int seconds)

Protected Member Functions

wxSocketClient * _CreateSocket ()
 Creates an TCP socket and sets it up.
bool _Send (const wxString &data)
 Internal send function.

Protected Attributes

wxSocketClient * m_sock
SocketEventsm_events
wxCriticalSection m_lock
wxString m_ping_msg
bool m_connecting
bool m_wait_on_connect
bool m_blocking
iNetClassm_net_class
unsigned int m_udp_private_port
int m_rate
int m_sent
std::string m_buffer

Detailed Description

Class that implements a TCP client socket.

Definition at line 48 of file socket.h.


Constructor & Destructor Documentation

Socket::Socket ( iNetClass netclass,
bool  wait_on_connect = false,
bool  blocking = false 
)

Constructor.

Definition at line 66 of file socket.cpp.

Socket::~Socket (  ) 

Destructor.

Definition at line 81 of file socket.cpp.


Member Function Documentation

wxSocketClient * Socket::_CreateSocket (  )  [protected]

Creates an TCP socket and sets it up.

Definition at line 90 of file socket.cpp.

bool Socket::_Send ( const wxString data  )  [protected]

Internal send function.

Note:
Does not lock the criticalsection.

Definition at line 165 of file socket.cpp.

void Socket::Connect ( const wxString addr,
const int  port 
)

Connect to remote host.

Definition at line 117 of file socket.cpp.

void Socket::Disconnect (  ) 

Disconnect from remote host if connected.

Definition at line 141 of file socket.cpp.

SockError Socket::Error (  )  const

Get socket error code.

Todo:
Implement

Definition at line 318 of file socket.cpp.

wxString Socket::GetHandle (  ) 

Definition at line 235 of file socket.cpp.

wxString Socket::GetLocalAddress (  )  const

used to retrieve local ip address behind NAT to communicate to the server on login

Definition at line 325 of file socket.cpp.

int Socket::GetSendRateLimit (  )  [inline]

Definition at line 72 of file socket.h.

void Socket::OnTimer ( int  mselapsed  ) 

Definition at line 344 of file socket.cpp.

wxString Socket::Receive (  ) 

Receive data from connection.

Definition at line 194 of file socket.cpp.

wxString Socket::ReceiveSpecial (  ) 

used in plasmaservice, otherwise getting garbeld responses

bool Socket::Send ( const wxString data  ) 

Send data over connection.

Definition at line 156 of file socket.cpp.

void Socket::SetSendRateLimit ( int  Bps = -1  ) 

Set the maximum upload ratio.

Definition at line 338 of file socket.cpp.

void Socket::SetTimeout ( const int  seconds  ) 

Definition at line 134 of file socket.cpp.

SockState Socket::State (  ) 

Get curent socket state.

Definition at line 298 of file socket.cpp.


Field Documentation

bool Socket::m_blocking [protected]

Definition at line 90 of file socket.h.

std::string Socket::m_buffer [protected]

Definition at line 96 of file socket.h.

bool Socket::m_connecting [protected]

Definition at line 88 of file socket.h.

Definition at line 82 of file socket.h.

wxCriticalSection Socket::m_lock [protected]

Definition at line 84 of file socket.h.

Definition at line 91 of file socket.h.

Definition at line 86 of file socket.h.

int Socket::m_rate [protected]

Definition at line 94 of file socket.h.

int Socket::m_sent [protected]

Definition at line 95 of file socket.h.

wxSocketClient* Socket::m_sock [protected]

Definition at line 81 of file socket.h.

unsigned int Socket::m_udp_private_port [protected]

Definition at line 93 of file socket.h.

bool Socket::m_wait_on_connect [protected]

Definition at line 89 of file socket.h.


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

Generated on Thu Dec 29 00:11:49 2011 for SpringLobby by doxygen 1.6.3