|
Mixe for Privacy and Anonymity in the Internet
|
#include <CAClientSocket.hpp>
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. | |
Definition at line 32 of file CAClientSocket.hpp.
| virtual CAClientSocket::~CAClientSocket | ( | ) | [inline, virtual] |
Definition at line 35 of file CAClientSocket.hpp.
{
}
| 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.
| buff | the buffer which get the received data |
| len | size of buff |
| E_AGAIN,if | socket was in non-blocking mode and receive would block or a timeout was reached |
| 0 | if socket was gracefully closed |
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.
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;
}
| 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.
| buff | - the buffer of data to send |
| len | - content length |
| E_UNKNOWN,if | an error occured |
| E_SUCCESS,if | successful |
Implemented in CASocket, and CATLSClientSocket.
1.7.6.1