Difference between revisions of "TWSocket.LineEnd"
Jump to navigation
Jump to search
Markus.humm (talk | contribs) (first entry) |
Markus.humm (talk | contribs) |
||
Line 23: | Line 23: | ||
== Best practices == | == Best practices == | ||
+ | * Use a sequence as terminator which can never occur in your data | ||
+ | * A longer sequence makes occurrence in your data less likely | ||
== How to == | == How to == |
Revision as of 18:51, 21 December 2007
Main page -> ICS component reference -> TWSocket -> LineEnd
Definition
property LineMode: String;
Description
LineEnd specifies the delimiter sequence used to detect the end of a message. The sender must append this sequence to all packets he sends, otherwise the receiver will get garbage since several packets will be received as one.
Example
If the client always sends data lines which end on CR/LF and the server shall display the lines individually in a memo, the server would set LineMode to true so that he always receives whole lines without needing to look for the end of a line himself.
Socket.LineLimit:=100; // prevent denial of service or buffer // overflows Socket.LineEnd :=chr(10)+chr(13); // the sender has to terminate all // messages sent with this character // combination Socket.LineMode:=true;
In OnDataAvailable ReceiveStr is used to fetch the available data packet by packet.
Best practices
- Use a sequence as terminator which can never occur in your data
- A longer sequence makes occurrence in your data less likely