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

Socket Class Reference

#include <Socket.h>

Inheritance diagram for Socket:

ListenServer RealSocket MyServer ConnectSocket IncomingSocket MyConnectSocket MyIncomingSocket

Public Member Functions

 Socket ()
 Socket (socket_t _sock)
virtual ~Socket ()
void MakeSock ()
socket_t GetSock ()
int GetPort ()
string GetAddr ()
string GetLastError ()

Protected Member Functions

void Close ()

Protected Attributes

SocketType type
bool connected
int port
string addr
sockaddr_in saddr

Private Member Functions

void OnReadError ()
void OnConnected ()
void OnConnClosed ()
virtual void __OnConnClosed ()
virtual void __OnConnected ()
virtual void __OnRead ()=0
virtual void __OnClose ()=0
virtual void __OnReadError ()=0

Private Attributes

socket_t sock
bool is_SSL
CriticalSection cs

Friends

class SocketHandler
class RealSocket
class ListenServer

Constructor & Destructor Documentation

Socket::Socket  ) 
 

Definition at line 27 of file Socket.cpp.

References connected, is_SSL, sock, and WSA_FAILED.

Socket::Socket socket_t  _sock  ) 
 

Definition at line 51 of file Socket.cpp.

References connected, is_SSL, sock, and WSA_FAILED.

Socket::~Socket  )  [virtual]
 

Definition at line 72 of file Socket.cpp.

References Close(), and sock.


Member Function Documentation

virtual void Socket::__OnClose  )  [private, pure virtual]
 

Implemented in MyConnectSocket, MyIncomingSocket, ConnectSocket, IncomingSocket, ListenServer, and RealSocket.

Referenced by Close().

virtual void Socket::__OnConnClosed  )  [inline, private, virtual]
 

Reimplemented in MyConnectSocket, MyIncomingSocket, ConnectSocket, IncomingSocket, ListenServer, and RealSocket.

Definition at line 88 of file Socket.h.

Referenced by OnConnClosed().

virtual void Socket::__OnConnected  )  [inline, private, virtual]
 

Reimplemented in MyIncomingSocket, ConnectSocket, IncomingSocket, ListenServer, and RealSocket.

Definition at line 89 of file Socket.h.

Referenced by OnConnected().

virtual void Socket::__OnRead  )  [private, pure virtual]
 

Implemented in MyConnectSocket, MyIncomingSocket, ConnectSocket, IncomingSocket, ListenServer, and RealSocket.

virtual void Socket::__OnReadError  )  [private, pure virtual]
 

Implemented in MyConnectSocket, MyIncomingSocket, ConnectSocket, IncomingSocket, ListenServer, and RealSocket.

Referenced by OnReadError().

void Socket::Close  )  [protected]
 

Definition at line 111 of file Socket.cpp.

References __OnClose(), connected, and sock.

Referenced by ConnectSocket::Disconnect(), RealSocket::OnConnectionError(), OnReadError(), ListenServer::Stop(), and ~Socket().

string Socket::GetAddr  ) 
 

Definition at line 142 of file Socket.cpp.

References saddr.

Referenced by MyServer::__OnAccept(), and ListenServer::Start().

string Socket::GetLastError  ) 
 

Definition at line 149 of file Socket.cpp.

References StringLib::itos().

Referenced by ConnectSocket::Connect(), and ListenServer::Start().

int Socket::GetPort  ) 
 

Definition at line 134 of file Socket.cpp.

References saddr.

Referenced by MyServer::__OnAccept(), and ListenServer::Start().

socket_t Socket::GetSock  ) 
 

Definition at line 127 of file Socket.cpp.

References socket_t.

Referenced by MyIncomingSocket::__OnClose(), MyConnectSocket::__OnClose(), MyIncomingSocket::__OnConnClosed(), MyConnectSocket::__OnConnClosed(), MyIncomingSocket::__OnRead(), MyConnectSocket::__OnRead(), MyIncomingSocket::__OnReadError(), MyConnectSocket::__OnReadError(), ListenServer::Accept(), SocketHandler::Add(), ListenServer::Bind(), ConnectSocket::Connect(), SocketHandler::Handle(), ListenServer::Listen(), MakeSock(), ListenServer::OnAccept(), RealSocket::Read(), SocketHandler::Remove(), and RealSocket::WriteBuffer().

void Socket::MakeSock  ) 
 

Definition at line 78 of file Socket.cpp.

References ALREADY_HAVE_SOCKET, StringLib::debug(), GetSock(), sock, SOCKET_FAILED, SSL_FAILED, TYPE_TCP, TYPE_UDP, and WRONG_SOCKET_TYPE.

Referenced by ListenServer::Bind(), and ConnectSocket::Connect().

void Socket::OnConnClosed  )  [private]
 

Definition at line 195 of file Socket.cpp.

References __OnConnClosed(), Singleton< SocketHandler >::getInstance(), and SOCKETHANDLING_FAILED.

Referenced by RealSocket::Read().

void Socket::OnConnected  )  [private]
 

Definition at line 179 of file Socket.cpp.

References __OnConnected(), and connected.

void Socket::OnReadError  )  [private]
 

Definition at line 187 of file Socket.cpp.

References __OnReadError(), and Close().


Friends And Related Function Documentation

friend class ListenServer [friend]
 

Definition at line 61 of file Socket.h.

friend class RealSocket [friend]
 

Definition at line 60 of file Socket.h.

friend class SocketHandler [friend]
 

Reimplemented in ListenServer, and RealSocket.

Definition at line 59 of file Socket.h.


Field Documentation

string Socket::addr [protected]
 

Definition at line 109 of file Socket.h.

bool Socket::connected [protected]
 

Definition at line 107 of file Socket.h.

Referenced by Close(), OnConnected(), and Socket().

CriticalSection Socket::cs [private]
 

Definition at line 101 of file Socket.h.

bool Socket::is_SSL [private]
 

Definition at line 100 of file Socket.h.

Referenced by Socket().

int Socket::port [protected]
 

Definition at line 108 of file Socket.h.

struct sockaddr_in Socket::saddr [protected]
 

Definition at line 111 of file Socket.h.

Referenced by GetAddr(), and GetPort().

socket_t Socket::sock [private]
 

Definition at line 94 of file Socket.h.

Referenced by Close(), MakeSock(), Socket(), and ~Socket().

SocketType Socket::type [protected]
 

Definition at line 106 of file Socket.h.


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