Glossary

From Overbyte
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. In a TCP session, 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 prefixed. The easiest way however is to use a delimiter. Many line-based internet protocols such as SMTP simply use CRLF for this purpose. Component TWsocket provides two properties to ease recept of such delimited data. Properties LineMode and LineEnd. 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. But note that the sender must append the delimiter to each string explicitly. To send delimited data you may use method SendStr, for instance SendStr('Hello' + #13#10).

E

F

G

H

I

J

K

L

Line Mode

Property LineMode specifies how TWSocket component shall trigger the OnDataAvailable event upon incomming data packets. If line mode is off (the default), TWSocket will trigger an OnDataAvailable event for each incomming data packet. If line mode is on (LineMode is set to TRUE), then TWSocket will buffer incomming data packets and search for an end-of-line marker specified by property LineEnd (defaults to CR/LF pair). If no end-of-line marker is found, the received packet is kept in the internal buffer and no OnDataAvailable event is triggered. When the next data packet is received, another check is done to find the first line end. If it is 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 marker. If a second one is received, another OnDataAvailable will be triggered immediately. The advantage of using LineMode is that component users must not worry about packet fragmentation since they see data comming in line by line.

M

Message Pump

The message pump is the small code section which remove messages from the message queue and process it. Speaking Delphi, the most common appearence of the message pump is Application.ProcessMessages. However there are many other forms of message pump. The message pump is sometimes named message loop.

Message Queue

Windows is an event driven operating system. To implement events, Windows use messages posted to a message queue. Each thread can have his own message queue but doesn't have one by default. The main thread of a GUI application has always a message queue. Messages are retrieved for processing from the message queue by the message pump.

N

O

P

Q

R

S

Socket

The socket word is used to designate a data structure and associated processing used by the operating system to handle TCP/IP operation.

Speaking ICS, a class TWSocket (and his derived classes) encapsulate the operating system data structure and processing. Data structure become properties while processing become methods and events.

T

U

V

W

WinSock

Winsock is the name given by Microsoft the the operating system part which handle sockets. It is materialized by a number of DLL which implement an API. This API is encapsulated by the TWSocket class.

X

Y

Z