CSocket project page CSocket home page

CActiveSocket Class Reference

Provides a platform independent class to create an active socket. More...

#include <ActiveSocket.h>

Inheritance diagram for CActiveSocket:

Inheritance graph
[legend]
Collaboration diagram for CActiveSocket:

Collaboration graph
[legend]

Public Types

enum  CShutdownMode { Receives = SHUT_RD, Sends = SHUT_WR, Both = SHUT_RDWR }
 Defines the three possible states for shuting down a socket. More...
enum  CSocketError {
  SocketError = -1, SocketSuccess = 0, SocketInvalidSocket, SocketInvalidAddress,
  SocketInvalidPort, SocketConnectionRefused, SocketTimedout, SocketEwouldblock,
  SocketNotconnected, SocketEinprogress, SocketInterrupted, SocketConnectionAborted,
  SocketProtocolError, SocketFirewallError, SocketInvalidSocketBuffer, SocketConnectionReset,
  SocketAddressInUse, SocketInvalidPointer, SocketEunknown
}
 Defines all error codes handled by the CSimpleSocket class. More...
enum  CSocketType {
  SocketTypeInvalid, SocketTypeTcp, SocketTypeUdp, SocketTypeTcp6,
  SocketTypeUdp6, SocketTypeRaw
}
 Defines the socket types defined by CSimpleSocket class. More...

Public Member Functions

bool BindInterface (uint8 *pInterface)
 Bind socket to a specific interface when using multicast.
 CActiveSocket (CSocketType type=SocketTypeTcp)
virtual bool Close (void)
 Close socket.
bool DisableNagleAlgoritm ()
 Disable the Nagle algorithm (Set TCP_NODELAY to true).
bool EnableNagleAlgoritm ()
 Enable the Nagle algorithm (Set TCP_NODELAY to false).
int32 GetBytesReceived (void)
 Returns the number of bytes received on the last call to CSocket::Receive().
int32 GetBytesSent (void)
 Returns the number of bytes sent on the last call to CSocket::Send().
uint8 * GetClientAddr ()
 Returns clients Internet host address as a string in standard numbers-and-dots notation.
int16 GetClientPort ()
 Returns the port number on which the client is connected.
int32 GetConnectTimeoutSec (void)
 Gets the timeout value that specifies the maximum number of seconds a call to CSimpleSocket::Open waits until it completes.
int32 GetConnectTimeoutUSec (void)
 Gets the timeout value that specifies the maximum number of microseconds a call to CSimpleSocket::Open waits until it completes.
uint8 * GetData (void)
 Get a pointer to internal receive buffer.
bool GetMulticast ()
 Return true if socket is multicast or false is socket is unicast.
int32 GetReceiveTimeoutSec (void)
 Gets the timeout value that specifies the maximum number of seconds a a call to CSimpleSocket::Receive waits until it completes.
int32 GetReceiveTimeoutUSec (void)
 Gets the timeout value that specifies the maximum number of microseconds a call to CSimpleSocket::Receive waits until it completes.
uint16 GetReceiveWindowSize ()
 Get the TCP receive buffer window size for the current socket object.
int32 GetSendTimeoutSec (void)
 Gets the timeout value that specifies the maximum number of seconds a a call to CSimpleSocket::Send waits until it completes.
int32 GetSendTimeoutUSec (void)
 Gets the timeout value that specifies the maximum number of microseconds a call to CSimpleSocket::Send waits until it completes.
uint16 GetSendWindowSize ()
 Get the TCP send buffer window size for the current socket object.
uint8 * GetServerAddr ()
 Returns server Internet host address as a string in standard numbers-and-dots notation.
int16 GetServerPort ()
 Returns the port number on which the server is connected.
SOCKET GetSocketDescriptor ()
 Return socket descriptor.
int GetSocketDscp (void)
 Return Differentiated Services Code Point (DSCP) value currently set on the socket object.
CSocketError GetSocketError (void)
 Returns the last error that occured for the instace of the CSimpleSocket instance.
CSocketType GetSocketType ()
 Return socket descriptor.
uint32 GetTotalTimeMs ()
 Get the total time the of the last operation in milliseconds.
uint32 GetTotalTimeUsec ()
 Get the total time the of the last operation in microseconds.
virtual bool Initialize (void)
 Initialize instance of CSocket.
bool IsNonblocking (void)
 Returns blocking/non-blocking state of socket.
virtual bool IsSocketValid (void)
 Does the current instance of the socket object contain a valid socket descriptor.
virtual bool Open (const uint8 *pAddr, int16 nPort)
 Established a connection to the address specified by pAddr.
virtual int32 Receive (int32 nMaxBytes=1)
 Attempts to receive a block of data on an established connection.
virtual bool Select (int32 nTimeoutSec, int32 nTimeoutUSec)
 Examine the socket descriptor sets currently owned by the instance of the socket class (the readfds, writefds, and errorfds parameters) to see whether some of their descriptors are ready for reading, are ready for writing, or have an exceptional condition pending, respectively.
virtual bool Select (void)
 Examine the socket descriptor sets currently owned by the instance of the socket class (the readfds, writefds, and errorfds parameters) to see whether some of their descriptors are ready for reading, are ready for writing, or have an exceptional condition pending, respectively.
virtual int32 Send (const struct iovec *sendVector, int32 nNumItems)
 Attempts to send at most nNumItem blocks described by sendVector to the socket descriptor associated with the socket object.
virtual int32 Send (const uint8 *pBuf, size_t bytesToSend)
 Attempts to send a block of data on an established connection.
virtual int32 SendFile (int32 nOutFd, int32 nInFd, off_t *pOffset, int32 nCount)
 Copies data between one file descriptor and another.
bool SetBlocking (void)
 Set the socket to blocking.
void SetConnectTimeout (int32 nConnectTimeoutSec, int32 nConnectTimeoutUsec=0)
 Sets the timeout value that specifies the maximum amount of time a call to CSimpleSocket::Receive waits until it completes.
bool SetMulticast (bool bEnable, uint8 multicastTTL=1)
 Enable/disable multicast for a socket.
bool SetNonblocking (void)
 Set the socket as non-blocking.
bool SetOptionLinger (bool bEnable, uint16 nTime)
 Controls the actions taken when CSimpleSocket::Close is executed on a socket object that has unsent data.
bool SetOptionReuseAddr ()
 Tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway.
bool SetReceiveTimeout (int32 nRecvTimeoutSec, int32 nRecvTimeoutUsec=0)
 Sets the timeout value that specifies the maximum amount of time a call to CSimpleSocket::Receive waits until it completes.
uint16 SetReceiveWindowSize (uint16 nWindowSize)
 Set the TCP receive buffer window size for the current socket object.
bool SetSendTimeout (int32 nSendTimeoutSec, int32 nSendTimeoutUsec=0)
 Gets the timeout value that specifies the maximum amount of time a call to CSimpleSocket::Send waits until it completes.
uint16 SetSendWindowSize (uint16 nWindowSize)
 Set the TCP send buffer window size for the current socket object.
bool SetSocketDscp (int nDscp)
 Set Differentiated Services Code Point (DSCP) for socket object.
virtual bool Shutdown (CShutdownMode nShutdown)
 Shutdown shut down socket send and receive operations CShutdownMode::Receives - Disables further receive operations.
void TranslateSocketError (void)
 Provides a standard error code for cross platform development by mapping the operating system error to an error defined by the CSocket class.
virtual ~CActiveSocket ()

Protected Member Functions

void SetSocketError (CSimpleSocket::CSocketError error)
 Set internal socket error to that specified error.
void SetSocketHandle (SOCKET socket)
 Set object socket handle to that specified as parameter.

Protected Attributes

bool m_bIsBlocking
 socket flags
bool m_bIsMulticast
 is socket blocking
fd_set m_errorFds
 read file descriptor set
int32 m_nBufferSize
 internal send/receive buffer
int32 m_nBytesReceived
 socket type - UDP, TCP or RAW
int32 m_nBytesSent
 number of bytes received
uint32 m_nFlags
 number of bytes sent
int32 m_nSocketDomain
 size of internal send/receive buffer
CSocketType m_nSocketType
 socket type PF_INET, PF_INET6
uint8 * m_pBuffer
 number of last error
fd_set m_readFds
 write file descriptor set
SOCKET m_socket
CSocketError m_socketErrno
 socket handle
struct sockaddr_in m_stClientSockaddr
 server address
struct timeval m_stConnectTimeout
 is the UDP socket multicast;
struct linger m_stLinger
 multicast group to bind to
struct sockaddr_in m_stMulticastGroup
 client address
struct timeval m_stRecvTimeout
 connection timeout
struct timeval m_stSendTimeout
 receive timeout
struct sockaddr_in m_stServerSockaddr
 send timeout
CStatTimer m_timer
 linger flag
fd_set m_writeFds
 internal statistics.

Friends

class CPassiveSocket

Detailed Description

Provides a platform independent class to create an active socket.

An active socket is used to create a socket which connects to a server. This type of object would be used when an application needs to send/receive data from a server.


Member Enumeration Documentation

enum CSimpleSocket::CShutdownMode [inherited]

Defines the three possible states for shuting down a socket.

Enumerator:
Receives  Shutdown passive socket.
Sends  Shutdown active socket.
Both  Shutdown both active and passive sockets.

enum CSimpleSocket::CSocketError [inherited]

Defines all error codes handled by the CSimpleSocket class.

Enumerator:
SocketError  Generic socket error translates to error below.
SocketSuccess  No socket error.
SocketInvalidSocket  Invalid socket handle.
SocketInvalidAddress  Invalid destination address specified.
SocketInvalidPort  Invalid destination port specified.
SocketConnectionRefused  No server is listening at remote address.
SocketTimedout  Timed out while attempting operation.
SocketEwouldblock  Operation would block if socket were blocking.
SocketNotconnected  Currently not connected.
SocketEinprogress  Socket is non-blocking and the connection cannot be completed immediately.
SocketInterrupted  Call was interrupted by a signal that was caught before a valid connection arrived.
SocketConnectionAborted  The connection has been aborted.
SocketProtocolError  Invalid protocol for operation.
SocketFirewallError  Firewall rules forbid connection.
SocketInvalidSocketBuffer  The receive buffer point outside the process's address space.
SocketConnectionReset  Connection was forcibly closed by the remote host.
SocketAddressInUse  Address already in use.
SocketInvalidPointer  Pointer type supplied as argument is invalid.
SocketEunknown  Unknown error please report to mark@carrierlabs.com.

enum CSimpleSocket::CSocketType [inherited]

Defines the socket types defined by CSimpleSocket class.

Enumerator:
SocketTypeInvalid  Invalid socket type.
SocketTypeTcp  Defines socket as TCP socket.
SocketTypeUdp  Defines socket as UDP socket.
SocketTypeTcp6  Defines socket as IPv6 TCP socket.
SocketTypeUdp6  Defines socket as IPv6 UDP socket.
SocketTypeRaw  Provides raw network protocol access.


Constructor & Destructor Documentation

CActiveSocket::CActiveSocket ( CSocketType  type = SocketTypeTcp  ) 

virtual CActiveSocket::~CActiveSocket (  )  [inline, virtual]


Member Function Documentation

bool CSimpleSocket::BindInterface ( uint8 *  pInterface  )  [inherited]

Bind socket to a specific interface when using multicast.

Returns:
true if successfully bound to interface

bool CSimpleSocket::Close ( void   )  [virtual, inherited]

Close socket.

Returns:
true if successfully closed otherwise returns false.

bool CSimpleSocket::DisableNagleAlgoritm (  )  [inherited]

Disable the Nagle algorithm (Set TCP_NODELAY to true).

Returns:
false if failed to set socket option otherwise return true;

bool CSimpleSocket::EnableNagleAlgoritm (  )  [inherited]

Enable the Nagle algorithm (Set TCP_NODELAY to false).

Returns:
false if failed to set socket option otherwise return true;

int32 CSimpleSocket::GetBytesReceived ( void   )  [inline, inherited]

Returns the number of bytes received on the last call to CSocket::Receive().

Returns:
number of bytes received.

int32 CSimpleSocket::GetBytesSent ( void   )  [inline, inherited]

Returns the number of bytes sent on the last call to CSocket::Send().

Returns:
number of bytes sent.

uint8* CSimpleSocket::GetClientAddr (  )  [inline, inherited]

Returns clients Internet host address as a string in standard numbers-and-dots notation.

Returns:
NULL if invalid

int16 CSimpleSocket::GetClientPort (  )  [inline, inherited]

Returns the port number on which the client is connected.

Returns:
client port number.

int32 CSimpleSocket::GetConnectTimeoutSec ( void   )  [inline, inherited]

Gets the timeout value that specifies the maximum number of seconds a call to CSimpleSocket::Open waits until it completes.

Returns:
the length of time in seconds

int32 CSimpleSocket::GetConnectTimeoutUSec ( void   )  [inline, inherited]

Gets the timeout value that specifies the maximum number of microseconds a call to CSimpleSocket::Open waits until it completes.

Returns:
the length of time in microseconds

uint8* CSimpleSocket::GetData ( void   )  [inline, inherited]

Get a pointer to internal receive buffer.

The user MUST not free this pointer when finished. This memory is managed internally by the CSocket class.

Returns:
pointer to data if valid, else returns NULL.

bool CSimpleSocket::GetMulticast (  )  [inline, inherited]

Return true if socket is multicast or false is socket is unicast.

Returns:
true if multicast is enabled

int32 CSimpleSocket::GetReceiveTimeoutSec ( void   )  [inline, inherited]

Gets the timeout value that specifies the maximum number of seconds a a call to CSimpleSocket::Receive waits until it completes.

Returns:
the length of time in seconds

int32 CSimpleSocket::GetReceiveTimeoutUSec ( void   )  [inline, inherited]

Gets the timeout value that specifies the maximum number of microseconds a call to CSimpleSocket::Receive waits until it completes.

Returns:
the length of time in microseconds

uint16 CSimpleSocket::GetReceiveWindowSize (  )  [inline, inherited]

Get the TCP receive buffer window size for the current socket object.



NOTE: Linux will set the receive buffer to twice the value passed.

Returns:
zero on failure else the number of bytes of the TCP receive buffer window size if successful.

int32 CSimpleSocket::GetSendTimeoutSec ( void   )  [inline, inherited]

Gets the timeout value that specifies the maximum number of seconds a a call to CSimpleSocket::Send waits until it completes.

Returns:
the length of time in seconds

int32 CSimpleSocket::GetSendTimeoutUSec ( void   )  [inline, inherited]

Gets the timeout value that specifies the maximum number of microseconds a call to CSimpleSocket::Send waits until it completes.

Returns:
the length of time in microseconds

uint16 CSimpleSocket::GetSendWindowSize (  )  [inline, inherited]

Get the TCP send buffer window size for the current socket object.



NOTE: Linux will set the send buffer to twice the value passed.

Returns:
zero on failure else the number of bytes of the TCP receive buffer window size if successful.

uint8* CSimpleSocket::GetServerAddr (  )  [inline, inherited]

Returns server Internet host address as a string in standard numbers-and-dots notation.

Returns:
NULL if invalid

int16 CSimpleSocket::GetServerPort (  )  [inline, inherited]

Returns the port number on which the server is connected.

Returns:
server port number.

SOCKET CSimpleSocket::GetSocketDescriptor (  )  [inline, inherited]

Return socket descriptor.

Returns:
socket descriptor which is a signed 32 bit integer.

int32 CSimpleSocket::GetSocketDscp ( void   )  [inherited]

Return Differentiated Services Code Point (DSCP) value currently set on the socket object.

Returns:
DSCP for current socket object.

NOTE: Windows special notes http://support.microsoft.com/kb/248611.

CSocketError CSimpleSocket::GetSocketError ( void   )  [inline, inherited]

Returns the last error that occured for the instace of the CSimpleSocket instance.

This method should be called immediately to retrieve the error code for the failing mehtod call.

Returns:
last error that occured.

CSocketType CSimpleSocket::GetSocketType (  )  [inline, inherited]

Return socket descriptor.

Returns:
socket descriptor which is a signed 32 bit integer.

uint32 CSimpleSocket::GetTotalTimeMs (  )  [inline, inherited]

Get the total time the of the last operation in milliseconds.

Returns:
number of milliseconds of last operation.

uint32 CSimpleSocket::GetTotalTimeUsec (  )  [inline, inherited]

Get the total time the of the last operation in microseconds.

Returns:
number of microseconds or last operation.

bool CSimpleSocket::Initialize ( void   )  [virtual, inherited]

Initialize instance of CSocket.

This method MUST be called before an object can be used. Errors : CSocket::SocketProtocolError, CSocket::SocketInvalidSocket,

Returns:
true if properly initialized.

bool CSimpleSocket::IsNonblocking ( void   )  [inline, inherited]

Returns blocking/non-blocking state of socket.

Returns:
true if the socket is non-blocking, else return false.

virtual bool CSimpleSocket::IsSocketValid ( void   )  [inline, virtual, inherited]

Does the current instance of the socket object contain a valid socket descriptor.

Returns:
true if the socket object contains a valid socket descriptor.

bool CActiveSocket::Open ( const uint8 *  pAddr,
int16  nPort 
) [virtual]

Established a connection to the address specified by pAddr.

Connection-based protocol sockets (CSocket::SocketTypeTcp) may successfully call Open() only once, however; connectionless protocol sockets (CSocket::SocketTypeUdp) may use Open() multiple times to change their association.

Parameters:
pAddr specifies the destination address to connect.
nPort specifies the destination port.
Returns:
true if successful connection made, otherwise false.

int32 CSimpleSocket::Receive ( int32  nMaxBytes = 1  )  [virtual, inherited]

Attempts to receive a block of data on an established connection.

Parameters:
nMaxBytes maximum number of bytes to receive.
Returns:
number of bytes actually received.

of zero means the connection has been shutdown on the other side.

of -1 means that an error has occurred.

bool CSimpleSocket::Select ( int32  nTimeoutSec,
int32  nTimeoutUSec 
) [virtual, inherited]

Examine the socket descriptor sets currently owned by the instance of the socket class (the readfds, writefds, and errorfds parameters) to see whether some of their descriptors are ready for reading, are ready for writing, or have an exceptional condition pending, respectively.

Parameters:
nTimeoutSec timeout in seconds for select.
nTimeoutUSec timeout in micro seconds for select.
Returns:
true if socket has data ready, or false if not ready or timed out.

virtual bool CSimpleSocket::Select ( void   )  [inline, virtual, inherited]

Examine the socket descriptor sets currently owned by the instance of the socket class (the readfds, writefds, and errorfds parameters) to see whether some of their descriptors are ready for reading, are ready for writing, or have an exceptional condition pending, respectively.

Block until an event happens on the specified file descriptors.

Returns:
true if socket has data ready, or false if not ready or timed out.

int32 CSimpleSocket::Send ( const struct iovec *  sendVector,
int32  nNumItems 
) [virtual, inherited]

Attempts to send at most nNumItem blocks described by sendVector to the socket descriptor associated with the socket object.

Parameters:
sendVector pointer to an array of iovec structures
nNumItems number of items in the vector to process
NOTE: Buffers are processed in the order specified.
Returns:
number of bytes actually sent, return of zero means the connection has been shutdown on the other side, and a return of -1 means that an error has occurred.

int32 CSimpleSocket::Send ( const uint8 *  pBuf,
size_t  bytesToSend 
) [virtual, inherited]

Attempts to send a block of data on an established connection.

Parameters:
pBuf block of data to be sent.
bytesToSend size of data block to be sent.
Returns:
number of bytes actually sent.

of zero means the connection has been shutdown on the other side.

of -1 means that an error has occurred.

Reimplemented in CHttpActiveSocket, and CPassiveSocket.

int32 CSimpleSocket::SendFile ( int32  nOutFd,
int32  nInFd,
off_t *  pOffset,
int32  nCount 
) [virtual, inherited]

Copies data between one file descriptor and another.

On some systems this copying is done within the kernel, and thus is more efficient than the combination of CSimpleSocket::Send and CSimpleSocket::Receive, which would require transferring data to and from user space.
Note: This is available on all implementations, but the kernel implementation is only available on Unix type systems.

Parameters:
nOutFd descriptor opened for writing.
nInFd descriptor opened for reading.
pOffset from which to start reading data from input file.
nCount number of bytes to copy between file descriptors.
Returns:
number of bytes written to the out socket descriptor.

bool CSimpleSocket::SetBlocking ( void   )  [inherited]

Set the socket to blocking.

Returns:
true if successful set to blocking, else return false;

void CSimpleSocket::SetConnectTimeout ( int32  nConnectTimeoutSec,
int32  nConnectTimeoutUsec = 0 
) [inline, inherited]

Sets the timeout value that specifies the maximum amount of time a call to CSimpleSocket::Receive waits until it completes.

Use the method CSimpleSocket::SetReceiveTimeout to specify the number of seconds to wait. If a call to CSimpleSocket::Receive has blocked for the specified length of time without receiving additional data, it returns with a partial count or CSimpleSocket::GetSocketError set to CSimpleSocket::SocketEwouldblock if no data were received.

Parameters:
nConnectTimeoutSec of timeout in seconds.
nConnectTimeoutUsec of timeout in microseconds.
Returns:
true if socket connection timeout was successfully set.

bool CSimpleSocket::SetMulticast ( bool  bEnable,
uint8  multicastTTL = 1 
) [inherited]

Enable/disable multicast for a socket.

This options is only valid for socket descriptors of type CSimpleSocket::SocketTypeUdp.

Returns:
true if multicast was enabled or false if socket type is not CSimpleSocket::SocketTypeUdp and the error will be set to CSimpleSocket::SocketProtocolError

bool CSimpleSocket::SetNonblocking ( void   )  [inherited]

Set the socket as non-blocking.

Returns:
true if successful set to non-blocking, else return false;

bool CSimpleSocket::SetOptionLinger ( bool  bEnable,
uint16  nTime 
) [inherited]

Controls the actions taken when CSimpleSocket::Close is executed on a socket object that has unsent data.

The default value for this option is off.

  • Following are the three possible scenarios.
    1. bEnable is false, CSimpleSocket::Close returns immediately, but any unset data is transmitted (after CSimpleSocket::Close returns)
    2. bEnable is true and nTime is zero, CSimpleSocket::Close return immediately and any unsent data is discarded.
    3. bEnable is true and nTime is nonzero, CSimpleSocket::Close does not return until all unsent data is transmitted (or the connection is Closed by the remote system).

Parameters:
bEnable true to enable option false to disable option.
nTime time in seconds to linger.
Returns:
true if option successfully set

bool CSimpleSocket::SetOptionReuseAddr (  )  [inherited]

Tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway.

If it is busy, but with another state, you will still get an address already in use error.

Returns:
true if option successfully set

bool CSimpleSocket::SetReceiveTimeout ( int32  nRecvTimeoutSec,
int32  nRecvTimeoutUsec = 0 
) [inherited]

Sets the timeout value that specifies the maximum amount of time a call to CSimpleSocket::Receive waits until it completes.

Use the method CSimpleSocket::SetReceiveTimeout to specify the number of seconds to wait. If a call to CSimpleSocket::Receive has blocked for the specified length of time without receiving additional data, it returns with a partial count or CSimpleSocket::GetSocketError set to CSimpleSocket::SocketEwouldblock if no data were received.

Parameters:
nRecvTimeoutSec of timeout in seconds.
nRecvTimeoutUsec of timeout in microseconds.
Returns:
true if socket timeout was successfully set.

uint16 CSimpleSocket::SetReceiveWindowSize ( uint16  nWindowSize  )  [inline, inherited]

Set the TCP receive buffer window size for the current socket object.



NOTE: Linux will set the receive buffer to twice the value passed.

Returns:
zero on failure else the number of bytes of the TCP send buffer window size if successful.

bool CSimpleSocket::SetSendTimeout ( int32  nSendTimeoutSec,
int32  nSendTimeoutUsec = 0 
) [inherited]

Gets the timeout value that specifies the maximum amount of time a call to CSimpleSocket::Send waits until it completes.

Returns:
the length of time in seconds

uint16 CSimpleSocket::SetSendWindowSize ( uint16  nWindowSize  )  [inline, inherited]

Set the TCP send buffer window size for the current socket object.



NOTE: Linux will set the send buffer to twice the value passed.

Returns:
zero on failure else the number of bytes of the TCP send buffer window size if successful.

bool CSimpleSocket::SetSocketDscp ( int  nDscp  )  [inherited]

Set Differentiated Services Code Point (DSCP) for socket object.

Parameters:
nDscp value of TOS setting which will be converted to DSCP
Returns:
true if DSCP value was properly set

NOTE: Windows special notes http://support.microsoft.com/kb/248611.

void CSimpleSocket::SetSocketError ( CSimpleSocket::CSocketError  error  )  [inline, protected, inherited]

Set internal socket error to that specified error.

Parameters:
error type of error

void CSimpleSocket::SetSocketHandle ( SOCKET  socket  )  [inline, protected, inherited]

Set object socket handle to that specified as parameter.

Parameters:
socket value of socket descriptor

bool CSimpleSocket::Shutdown ( CShutdownMode  nShutdown  )  [virtual, inherited]

Shutdown shut down socket send and receive operations CShutdownMode::Receives - Disables further receive operations.

CShutdownMode::Sends - Disables further send operations. CShutdownBoth:: - Disables further send and receive operations.

Parameters:
nShutdown specifies the type of shutdown.
Returns:
true if successfully shutdown otherwise returns false.

void CSimpleSocket::TranslateSocketError ( void   )  [inherited]

Provides a standard error code for cross platform development by mapping the operating system error to an error defined by the CSocket class.


Friends And Related Function Documentation

friend class CPassiveSocket [friend]


Field Documentation

bool CSimpleSocket::m_bIsBlocking [protected, inherited]

socket flags

bool CSimpleSocket::m_bIsMulticast [protected, inherited]

is socket blocking

fd_set CSimpleSocket::m_errorFds [protected, inherited]

read file descriptor set

int32 CSimpleSocket::m_nBufferSize [protected, inherited]

internal send/receive buffer

int32 CSimpleSocket::m_nBytesReceived [protected, inherited]

socket type - UDP, TCP or RAW

int32 CSimpleSocket::m_nBytesSent [protected, inherited]

number of bytes received

uint32 CSimpleSocket::m_nFlags [protected, inherited]

number of bytes sent

int32 CSimpleSocket::m_nSocketDomain [protected, inherited]

size of internal send/receive buffer

CSocketType CSimpleSocket::m_nSocketType [protected, inherited]

socket type PF_INET, PF_INET6

uint8* CSimpleSocket::m_pBuffer [protected, inherited]

number of last error

fd_set CSimpleSocket::m_readFds [protected, inherited]

write file descriptor set

SOCKET CSimpleSocket::m_socket [protected, inherited]

socket handle

struct sockaddr_in CSimpleSocket::m_stClientSockaddr [read, protected, inherited]

server address

struct timeval CSimpleSocket::m_stConnectTimeout [read, protected, inherited]

is the UDP socket multicast;

struct linger CSimpleSocket::m_stLinger [read, protected, inherited]

multicast group to bind to

struct sockaddr_in CSimpleSocket::m_stMulticastGroup [read, protected, inherited]

client address

struct timeval CSimpleSocket::m_stRecvTimeout [read, protected, inherited]

connection timeout

struct timeval CSimpleSocket::m_stSendTimeout [read, protected, inherited]

receive timeout

struct sockaddr_in CSimpleSocket::m_stServerSockaddr [read, protected, inherited]

send timeout

CStatTimer CSimpleSocket::m_timer [protected, inherited]

linger flag

fd_set CSimpleSocket::m_writeFds [protected, inherited]

internal statistics.


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

CarrierLabs Logo hosts this site.
Send comments to:
CarrierLabs Developers