Difference between revisions of "TWSocket.Receive"
Jump to navigation
Jump to search
Markus.humm (talk | contribs) (Method signature corrected) |
m |
||
Line 3: | Line 3: | ||
== Definition == | == Definition == | ||
− | ''' | + | '''function''' Receive(Buffer:Pointer; BufferSize:Integer): '''integer'''; |
== Description == | == Description == |
Revision as of 21:37, 21 November 2007
Main page -> ICS component reference -> TWSocket -> Receive
Definition
function Receive(Buffer:Pointer; BufferSize:Integer): integer;
Description
Receive is used in the OnDataAvailable-Event to actually fetch the received data. The parameters needed are a buffer where the data will be placed and the size of that buffer. The return value of Receive specifies how many bytes where actually read and put in the buffer. If the buffer is too small, OnDataAvailable will occur again until all data is received.
Example
procedure WSocket1OnDataAvailable(Sender: TObject; ErrCode: Word); var buf:array[1..64] of byte; len:Integer; begin if ErrCode <> 0 then exit; len:=Receive(@buf, sizeof(buf)); // here your procesing of the data will take place end;