Difference between revisions of "TWSocket.LineLength"

From Overbyte
Jump to navigation Jump to search
(first entry)
 
 
Line 10: Line 10:
  
 
== Example ==
 
== Example ==
 +
<syntaxhighlight lang="delphi">
 
   procedure TMySocket.MyOnDataAvailable(Sender: TObject; ErrCode: Word);
 
   procedure TMySocket.MyOnDataAvailable(Sender: TObject; ErrCode: Word);
 
   var s  :String; // received packet
 
   var s  :String; // received packet
Line 26: Line 27:
 
       MessageBox(s);
 
       MessageBox(s);
 
   end;
 
   end;
 +
</syntaxhighlight>
  
 
== Best practices ==
 
== Best practices ==
  
 
== How to ==
 
== How to ==

Latest revision as of 20:32, 1 July 2010

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

Definition

property LineLength: integer;

Description

LineLength specifies the length of the last received line in characters if the socket is in LineMode. It will normally be used within the OnDataAvailable eventhandler.

Example

<syntaxhighlight lang="delphi">

 procedure TMySocket.MyOnDataAvailable(Sender: TObject; ErrCode: Word);
 var s  :String; // received packet
     len:Integer; // length of the received packet
 begin
   if ErrCode <> 0 then exit;
   
   s:=;
   s:=ReceiveStr;
   len:=LineLength;
   if (len < 5) then
   begin
     exit;
   end
   else
     MessageBox(s);
 end;

</syntaxhighlight>

Best practices

How to