Class CTCPSocketAsync::
Send()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: ReceiveNext page: SendBlockedBuffer    Show member index
Public Function Declared in:
TCPSocketAsync.h

'Declaration' icon -- Shortcut to top of page. Declaration

virtual int Send(
    const char* pBuffer,
    unsigned long ulBufferLength);

'Description' icon -- Shortcut to top of page. Description

Send 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' icon -- Shortcut to top of page. 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' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CTCPSocket  |  Public base class CAsyncSocket  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!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.