Mixe for Privacy and Anonymity in the Internet
Public Member Functions
CAClientSocket Class Reference

#include <CAClientSocket.hpp>

Inheritance diagram for CAClientSocket:
[legend]

List of all members.

Public Member Functions

virtual ~CAClientSocket ()
virtual SINT32 sendFully (const UINT8 *buff, UINT32 len)=0
 Sends all data over the network.
virtual SINT32 receive (UINT8 *buff, UINT32 len)=0
 Will receive some bytes from the socket.
SINT32 receiveFully (UINT8 *buff, UINT32 len)
 Receives all len bytes.

Detailed Description

Definition at line 32 of file CAClientSocket.hpp.


Constructor & Destructor Documentation

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

Definition at line 35 of file CAClientSocket.hpp.

        {
        }

Member Function Documentation

virtual SINT32 CAClientSocket::receive ( UINT8 buff,
UINT32  len 
) [pure virtual]

Will receive some bytes from the socket.

May block or not depending on the implementation.

Parameters:
buffthe buffer which get the received data
lensize of buff
Returns:
SOCKET_ERROR if an error occured
Return values:
E_AGAIN,ifsocket was in non-blocking mode and receive would block or a timeout was reached
0if socket was gracefully closed
Returns:
the number of bytes received (always >0)

Implemented in CASocket, and CATLSClientSocket.

Referenced by receiveFully().

SINT32 CAClientSocket::receiveFully ( UINT8 buff,
UINT32  len 
) [inline]

Receives all len bytes.

This blocks until all bytes are received or an error occured.

Returns:
E_UNKNOWN, in case of an error
E_SUCCESS otherwise

Definition at line 61 of file CAClientSocket.hpp.

References E_AGAIN, E_SUCCESS, E_UNKNOWN, msSleep(), and receive().

Referenced by CALocalProxy::init(), CALocalProxy::processKeyExchange(), CAMuxSocket::receive(), and CAMuxSocket::receiveFully().

      {
        SINT32 ret;
        UINT32 pos=0;
        do
          {
            ret=receive(buff+pos,len);
            if(ret<=0)
            {
              if(ret==E_AGAIN)
              {
                msSleep(100);
                continue;
              }
              else
              {
                return E_UNKNOWN;
              }
            }
            pos+=ret;
            len-=ret;
          }
        while(len>0);
        return E_SUCCESS;           
      }

Here is the call graph for this function:

virtual SINT32 CAClientSocket::sendFully ( const UINT8 buff,
UINT32  len 
) [pure virtual]

Sends all data over the network.

This may block until all data is send.

Parameters:
buff- the buffer of data to send
len- content length
Return values:
E_UNKNOWN,ifan error occured
E_SUCCESS,ifsuccessful

Implemented in CASocket, and CATLSClientSocket.


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