Glossary

From Overbyte
Revision as of 20:34, 5 March 2006 by Arno (talk | contribs) (→‎Server)
Jump to navigation Jump to search

Main page -> Glossary

A

B

Blocking Mode

See non blocking mode.

C

Client

When speaking about sockets, a client is the program responsible for taking the initiative to connect to a remote system known as the Server.

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

Event Driven

A program is said to be "event driven" when his opertaion is governed by events. An event is a code section, a component method, which is invoked when some condition occurs. For example, when data is received by a TWSocket, his OnDataAvailable, event is triggered. I means that the code assigned to the event by the programmer is executed.

In an event driven program, the programmer doesn't wait for something to happend. The program just do nothing, until the event is triggered. The program is said to be idle.

When using event driven components such as ICS, you seldom use sequential programming. You use a cascade of events. Let's take a simple example: Imagine our program must connect to a remote server, wait until the server sent his welcome message, then send a command and grab the result. In an event driven program, using an event driven component such as TWSocket, you call Connect and return. In OnDataAvailable you check for the welcome message. When received completely (easy with Line Mode) you send your command. In subsequent OnDataAvailable you grab the command result.

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 Loop

See message pump.

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

Non Blocking Mode

A component is said to work in non blocking mode when it execute lengthy tasks in the background. Most ICS component have non blocking operation. For example, when you call TWSocket.Connect, you get control back immediately while the connection occurs automatically in the background. Eventually when the connection is established, the component triggers an OnSessionConnected event to let you know the operation you requested is done (or failed). See also blocking mode.

O

P

Q

R

S

Server

When speaking about sockets, a server is the program passively listening for incomming client connections.

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

TCP

Transmission Control Protocol. One of the protocol in the TCP/IP protocol suite. TCP is a reliable, stream oriented transport. TCP is responsible for verifying delivery from client to server. TCP is a point-to-point protocol requiring a connection to be established.

TCP/IP

Transmission Control Protocol/Internet Protocol. It is a family of protocols designed to allow computers to talk to each other over any kind of networks. The family name comes from two major protocols: IP which is responsible for moving packets of data between nodes and TCP which is responsible for verifying delivery from client to server. TCP/IP forms the basis of the Internet

Timeout

When an operation is not completed after a predefined period of time, it is said to be timed out. The timeout is the period of time after which we consider the operation will never be completed.

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