Pol  Rev 533
Socket Class Reference

#include <wnsckt.h>

List of all members.

Public Types

enum  option { none = 0, nonblocking = 1, reuseaddr = 2 }

Public Member Functions

 Socket ()
 Socket (SOCKET sock)
 Socket (Socket &sck)
virtual ~Socket ()
bool accept (SOCKET *s, unsigned int mstimeout)
bool accept (Socket &newsocket)
void close ()
bool connected () const
std::string getpeername () const
SOCKET handle () const
bool is_local ()
bool listen (unsigned short port)
bool open (const char *ipaddr, unsigned short port)
unsigned peek (void *vdest, unsigned len, unsigned int waitms)
struct sockaddr peer_address () const
bool recvbyte (unsigned char *byte, unsigned int waitms)
bool recvdata (void *vdest, unsigned len, unsigned int waitms)
SOCKET release_handle ()
bool select (unsigned int seconds, unsigned int useconds)
void send (const void *data, unsigned length)
bool send_nowait (const void *vdata, unsigned datalen, unsigned *nsent)
void set_options (option opt)
void setpeer (struct sockaddr peer)
void setsocket (SOCKET sck)
void takesocket (Socket &sck)
void write (const std::string &str)

Protected Member Functions

void apply_prebind_socket_options (SOCKET sck)
void apply_socket_options (SOCKET sck)

Private Member Functions

void HandleError ()

Private Attributes

int _options
struct sockaddr _peer
SOCKET _sck

Detailed Description

Definition at line 15 of file wnsckt.h.


Member Enumeration Documentation

Enumerator:
none 
nonblocking 
reuseaddr 

Definition at line 18 of file wnsckt.h.


Constructor & Destructor Documentation

Definition at line 50 of file wnsckt.cpp.

Socket::Socket ( SOCKET  sock) [explicit]

Definition at line 65 of file wnsckt.cpp.

Socket::Socket ( Socket sck)

Definition at line 71 of file wnsckt.cpp.

References _sck, and INVALID_SOCKET.

Socket::~Socket ( ) [virtual]

Definition at line 79 of file wnsckt.cpp.

References close().

+ Here is the call graph for this function:


Member Function Documentation

bool Socket::accept ( SOCKET s,
unsigned int  mstimeout 
)

Definition at line 253 of file wnsckt.cpp.

References _sck, apply_socket_options(), and INVALID_SOCKET.

Referenced by SocketListener::accept(), and accept().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Socket::accept ( Socket newsocket)

Definition at line 268 of file wnsckt.cpp.

References _sck, accept(), apply_socket_options(), INVALID_SOCKET, setpeer(), and setsocket().

+ Here is the call graph for this function:

void Socket::apply_prebind_socket_options ( SOCKET  sck) [protected]

Definition at line 182 of file wnsckt.cpp.

References _options, decint(), and reuseaddr.

Referenced by listen().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Socket::apply_socket_options ( SOCKET  sck) [protected]

Definition at line 163 of file wnsckt.cpp.

References _options, decint(), and nonblocking.

Referenced by accept(), and listen().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Socket::close ( void  )

Definition at line 592 of file wnsckt.cpp.

References _sck, and INVALID_SOCKET.

Referenced by HandleError(), http_readline(), listen(), open(), peek(), readline(), recvbyte(), recvdata(), AuxClientThread::run(), setsocket(), and ~Socket().

+ Here is the caller graph for this function:

bool Socket::connected ( ) const

Definition at line 286 of file wnsckt.cpp.

References _sck, and INVALID_SOCKET.

Referenced by http_func(), http_readline(), HttpExecutorModule::mf_WriteHtml(), HttpExecutorModule::mf_WriteHtmlRaw(), readline(), readstring(), AuxClientThread::run(), and send_binary().

+ Here is the caller graph for this function:

string Socket::getpeername ( ) const

Definition at line 100 of file wnsckt.cpp.

References _sck.

Referenced by AuxClientThread::init(), is_local(), and HttpExecutorModule::read_query_ip().

+ Here is the caller graph for this function:

Definition at line 120 of file wnsckt.cpp.

References _sck.

Referenced by http_func().

+ Here is the caller graph for this function:

void Socket::HandleError ( ) [private]

Definition at line 292 of file wnsckt.cpp.

References close().

Referenced by listen(), peek(), recvbyte(), recvdata(), send(), and send_nowait().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Socket::is_local ( )

Definition at line 607 of file wnsckt.cpp.

References getpeername().

Referenced by http_func(), and DebugClientThread::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Socket::listen ( unsigned short  port)

Definition at line 197 of file wnsckt.cpp.

References _sck, apply_prebind_socket_options(), apply_socket_options(), close(), HandleError(), and INVALID_SOCKET.

Referenced by SocketListener::SocketListener().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Socket::open ( const char *  ipaddr,
unsigned short  port 
)

Definition at line 133 of file wnsckt.cpp.

References _sck, close(), and INVALID_SOCKET.

Referenced by OSExecutorModule::mf_OpenConnection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned Socket::peek ( void *  vdest,
unsigned  len,
unsigned int  waitms 
)

Definition at line 465 of file wnsckt.cpp.

References _sck, close(), exit_signalled, HandleError(), select(), SOCKET_ERRNO, and socket_errno.

+ Here is the call graph for this function:

struct sockaddr Socket::peer_address ( ) const [read]

Definition at line 115 of file wnsckt.cpp.

Referenced by AuxClientThread::init(), and UoClientThread::run().

+ Here is the caller graph for this function:

bool Socket::recvbyte ( unsigned char *  byte,
unsigned int  waitms 
)

Definition at line 336 of file wnsckt.cpp.

References _sck, close(), exit_signalled, HandleError(), select(), SOCKET_ERRNO, and socket_errno.

Referenced by http_readline(), readline(), and readstring().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Socket::recvdata ( void *  vdest,
unsigned  len,
unsigned int  waitms 
)

Definition at line 397 of file wnsckt.cpp.

References _sck, close(), exit_signalled, HandleError(), select(), SOCKET_ERRNO, and socket_errno.

+ Here is the call graph for this function:

Definition at line 125 of file wnsckt.cpp.

References _sck, and INVALID_SOCKET.

Referenced by UoClientThread::run().

+ Here is the caller graph for this function:

bool Socket::select ( unsigned int  seconds,
unsigned int  useconds 
)

Definition at line 230 of file wnsckt.cpp.

References _sck, exit_signalled, SOCKET_ERRNO, and socket_errno.

Referenced by SocketListener::GetConnection(), peek(), recvbyte(), and recvdata().

+ Here is the caller graph for this function:

void Socket::send ( const void *  data,
unsigned  length 
)

Definition at line 521 of file wnsckt.cpp.

References _sck, HandleError(), SOCKET_ERRNO, and socket_errno.

Referenced by http_writeline(), send_binary(), send_nowait(), write(), and writeline().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Socket::send_nowait ( const void *  vdata,
unsigned  datalen,
unsigned *  nsent 
)

Definition at line 552 of file wnsckt.cpp.

References _sck, HandleError(), send(), SOCKET_ERRNO, and socket_errno.

Referenced by HttpExecutorModule::mf_WriteHtml(), and HttpExecutorModule::mf_WriteHtmlRaw().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Socket::set_options ( option  opt)

Definition at line 90 of file wnsckt.cpp.

References _options.

Referenced by SocketListener::SocketListener().

+ Here is the caller graph for this function:

void Socket::setpeer ( struct sockaddr  peer)

Definition at line 95 of file wnsckt.cpp.

References _peer.

Referenced by accept().

+ Here is the caller graph for this function:

void Socket::setsocket ( SOCKET  sck)

Definition at line 84 of file wnsckt.cpp.

References _sck, and close().

Referenced by accept().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Socket::takesocket ( Socket sck)
void Socket::write ( const std::string &  str)

Definition at line 586 of file wnsckt.cpp.

References send().

+ Here is the call graph for this function:


Member Data Documentation

int Socket::_options [private]

Definition at line 67 of file wnsckt.h.

Referenced by apply_prebind_socket_options(), apply_socket_options(), and set_options().

struct sockaddr Socket::_peer [private]

Definition at line 68 of file wnsckt.h.

Referenced by setpeer().


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