Platform SDK: Logon Authentication

Example Code: SendMsg

//--------------------------------------------------------------------
//Define SendMsg()
//     Send a message over the socket by first sending a DWORD that 
//     represents the size of the message followed by the message 
//     itself. 
//     Return TRUE if successful; otherwise, FALSE. 

BOOL SendMsg (SOCKET s, PBYTE pBuf, DWORD cbBuf) 
{ 

//--------------------------------------------------------------------
//      Send the size of the message 

if (!(SendBytes (
     s, 
     (PBYTE)&cbBuf, 
     sizeof (cbBuf))))
{
     HandleError("Error sending number of bytes in SendMsg.");
}

//--------------------------------------------------------------------
//      Send the body of the message 
 
if (!(SendBytes (
     s, 
     pBuf, 
     cbBuf)))
{
     HandleError("Message body not sent.\n");
}
return(TRUE); 
} // end of SendMsg