Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

Socket Class Reference

wrapper for Windows or Berkeley Sockets More...

#include <socketft.h>

Inheritance diagram for Socket:
SocketSink SocketSource

List of all members.


class  Err
 exception thrown by Socket class More...

Public Member Functions

 Socket (socket_t s=INVALID_SOCKET, bool own=false)
 Socket (const Socket &s)
bool GetOwnership () const
void SetOwnership (bool own)
 operator socket_t ()
socket_t GetSocket () const
void AttachSocket (socket_t s, bool own=false)
socket_t DetachSocket ()
void CloseSocket ()
void Create (int nType=SOCK_STREAM)
void Bind (unsigned int port, const char *addr=NULL)
void Bind (const sockaddr *psa, socklen_t saLen)
void Listen (int backlog=5)
bool Connect (const char *addr, unsigned int port)
bool Connect (const sockaddr *psa, socklen_t saLen)
bool Accept (Socket &s, sockaddr *psa=NULL, socklen_t *psaLen=NULL)
void GetSockName (sockaddr *psa, socklen_t *psaLen)
void GetPeerName (sockaddr *psa, socklen_t *psaLen)
unsigned int Send (const byte *buf, size_t bufLen, int flags=0)
unsigned int Receive (byte *buf, size_t bufLen, int flags=0)
void ShutDown (int how=SD_SEND)
void IOCtl (long cmd, unsigned long *argp)
bool SendReady (const timeval *timeout)
bool ReceiveReady (const timeval *timeout)
virtual void HandleError (const char *operation) const
void CheckAndHandleError_int (const char *operation, int result) const
void CheckAndHandleError (const char *operation, socket_t result) const
void CheckAndHandleError (const char *operation, BOOL result) const
void CheckAndHandleError (const char *operation, bool result) const

Static Public Member Functions

static unsigned int PortNameToNumber (const char *name, const char *protocol="tcp")
 look up the port number given its name, returns 0 if not found
static void StartSockets ()
 start Windows Sockets 2
static void ShutdownSockets ()
 calls WSACleanup for Windows Sockets
static int GetLastError ()
 returns errno or WSAGetLastError
static void SetLastError (int errorCode)
 sets errno or calls WSASetLastError

Protected Member Functions

virtual void SocketChanged ()

Protected Attributes

socket_t m_s
bool m_own

Detailed Description

wrapper for Windows or Berkeley Sockets

Definition at line 43 of file socketft.h.

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