TWSocket.LineLength

From Overbyte
Revision as of 20:32, 1 July 2010 by Markus.humm (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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