![]() |
Send() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: TCPSocketAsync.h |
Declaration
virtual int Send(
const char* pBuffer,
unsigned long ulBufferLength);
DescriptionSend data over the sockets Send may fail because the system isn't ready to send the data, check out the value of the send SOCKET_ERROR - Failure 0 - Send couldn't finish because it would block if there was a blocking buffer, it was queued (check out AllowBlockedBuffer in CAsyncSocket) Value - Bytes sent
Function Body
try
{
//Send the data
int iResult;
iResult=SendNoAdd(pBuffer,
ulBufferLength);
//Did we succeed ?
if (iResult==GetErrorCode())
//Is it blocked send ?
if (WSAGetLastError()==WSAEWOULDBLOCK &&
GetBlockedBuffer())
{
//Add to the buffer, if we have one
GetBlockedBuffer()->AddRecord(CBlockedBuffer::CBlockedData(pBuffer,
ulBufferLength));
//We have not error
iResult=0;
}
//Blocking error (not really an error)
else if (WSAGetLastError()==WSAEWOULDBLOCK)
return 0;
else
//Set the error code
SetLastError("Send");
//Done
return iResult;
}
ERROR_HANDLER_RETURN("Send",GetErrorCode())
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |