Difference between revisions of "TWSocket.ReceiveStr"

From Overbyte
Jump to navigation Jump to search
(first entry)
 
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
 
== Definition ==
 
== Definition ==
  
  '''method''' ReceiveStr: '''string''';
+
  '''function''' ReceiveStr: '''string''';
  
 
== Description ==
 
== Description ==
Line 18: Line 18:
 
       exit;
 
       exit;
 
     end;
 
     end;
 
+
 
 
     s:=ReceiveStr;
 
     s:=ReceiveStr;
 
   end;
 
   end;

Latest revision as of 21:35, 21 November 2007

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

Definition

function 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