TWSocket.ReceiveStr
Jump to navigation
Jump to search
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
- always set LineLimit