Glossary

From Overbyte
Revision as of 07:48, 22 February 2006 by Sysop (talk | contribs) (→‎D)
Jump to navigation Jump to search

Main page -> Glossary

A

B

C

D

Delimited Data

Sender and receiver must agree on how to transfer data. Imagine a sender sends two strings "Hello" and "LogMeIn" one after another. How to make sure that they will be received also one after another as two separate strings? Most likely they will be received by winsock as one string like "HelloLogMeIn", winsock then notifies the application about data has been received and is available. As you can see the receiver needs some more information, either some delimiter is required in order to allow the receiver to split up data back into its original parts or the length of each part must be prepended. The easiest way however is to use a delimiter. Many line-based internet protocols such as SMTP simply use CRLF as the delimiter for this purpose. ICS provides properties and methods to easily send and receive such delimited data. Properties LineMode and LineEnd as well as method ReceiveStr. If you turn on LineMode event OnDataAvailable will fire only in case of the delimiter specified in property LineEnd has been received. In order to read such delimited data from within OnDataAvailable event handler you may simply call method ReceiveStr, that's it. OnDataAvailable would fire exactly twice and each call to ReceiveStr would return the right strings "Hello" and "LogMeIn". But note that the sender must send the delimiter with each string explicitly. To send delimited data you may use method SendStr, like SendStr('Hello' + #13#10).

E

F

G

H

I

J

K

L

Line Mode

Line mode specify how TWSocket component has to handle incomming data packets to produce OnDataAvailable event. When line mode is off (the default), TWSocket will trigger an OnDataAvailable event for each data packet incomming. When line mode is on (Set LineMode property to TRUE), then TWSocket will buffer incomming data packet and scan for an end of line delimiter (Property LineEnd which default to CR/LF pair). If no end of line delimiter is found, then the packet is kept in the internal buffer and no OnDataAvailable event is triggered. When the next data packet is received, again a check is done to find the first end of line. When one if found, the component triggers the OnDataAvailable event. When the Receive method is called from the OnDataAvailable event, it will return data up to and including the first end of line found. If a second one is received, another OnDataAvailable will be triggered immediately. The net effect is that the user see data comming line by line. Component user doesn't have to worry about packet fragmentation.

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z