System.Win.ScktComp.TCustomWinSocket.ReceiveBuf
Delphi
function ReceiveBuf(var Buf; Count: Integer): Integer;
C++
int __fastcall ReceiveBuf(void *Buf, int Count);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Win.ScktComp.pas System.Win.ScktComp.hpp |
System.Win.ScktComp | TCustomWinSocket |
Description
Reads up to Count bytes from the socket connection into the Buf parameter.
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. If no bytes are read, ReceiveBuf returns –1.
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.