Difference between revisions of "TWSocket.ReceiveStr"

From Overbyte
Jump to navigation Jump to search
(first entry)
 
(example -> empty line fixed)
Line 18: Line 18:
 
       exit;
 
       exit;
 
     end;
 
     end;
 
+
 
 
     s:=ReceiveStr;
 
     s:=ReceiveStr;
 
   end;
 
   end;

Revision as of 11:03, 20 September 2006

Main page -> ICS component reference -> TWSocket -> ReceiveStr

Definition

method ReceiveStr: string;

Description

ReceiveStr is used (mainly in OnDataAvailable if the component is set to use LineMode. It receives the next complete line which has been sent to the attached IP/port. ReceiveStr returns the whole line sent, including the delimiter characters set via LineEnd.

Example

 procedure TMySocket.MyOnDataAvailable(Sender: TObject; ErrCode: Word);
 var s    :String; // received packet
 begin
   if ErrCode <> 0 then
   begin
     exit;
   end;
 
   s:=ReceiveStr;
 end;

Best practices

How to