RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomWinSocket.ReceiveBuf Method

Reads up to Count bytes from the socket connection into the Buf parameter.

Pascal
function ReceiveBuf(var Buf; Count: Integer): Integer;
C++
__fastcall int ReceiveBuf( Buf, int Count);

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.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!