Writes Count bytes to the socket connection from the Buf parameter.
function SendBuf(var Buf; Count: Integer): Integer;
Description
Use SendBuf to write to the socket connection. The writing may occur in the OnSocketEvent event handler of a Windows socket object or in the OnWrite or OnClientWrite event handler of a socket component. Alternately, SendBuf may write from a socket that is expected to write to the connection without a notification to signal the connection抯 readiness to read. SendBuf returns the number of bytes actually written. If an error occurs while writing to the connection, SendBuf terminates the connection and raises an ESocketError exception.
Reads up to Count bytes from the socket connection into the Buf parameter.
function ReceiveBuf(var Buf; Count: Integer): Integer;
Description
Use ReceiveBuf to read from the socket connection in the OnSocketEvent event handler of a Windows socket object or in the OnRead or OnClientRead event handler of a socket component. ReceiveBuf returns the number of bytes actually read.
ReceiveBuf only works in response to a read notification to a non-blocking windows socket. Blocking sockets must use a TWinSocketStream for reading. The TWinSocketStream object waits for the remote socket to be ready before transferring information.
Note: While the ReceiveLength method can return an estimate of the size of buffer required to retrieve information from the socket, the number of bytes it returns is not necessarily accurate.
Delphi中有例子. 好像是 Chat 的例子.