SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
maXbox Starter 26
Start with Sockets
1.1 From Socket to Interprocess Communication
This Tutorial is based on an article by Chad Z. Hower which he wrote in the days of Indy 8.0
published on swissdelphicenter.ch years ago:
http://www.swissdelphicenter.ch/en/showarticle.php?id=4
I did also inherit a bit from the Starter 5 which deals with Internet Programming. Most of the
above mentioned article from Chad still applies and is very useful for newer versions of Indy.
It shows the implementation of an Indy Server which communicates with a client over TCP and
Sockets. I made it scriptable to demonstrate the fascination of 2 boxes communicate with each
other at the same time.
Indy uses blocking socket calls. Blocking calls are much like reading and writing to a file. When
you read data, or write data, the function will not return until the operation is complete. The
difference from working with files is that the call may take much longer as data may not be
immediately ready for reading or writing (It can only operate as fast as the network or the modem
can handle the data).
For example, to connect simply call the connect method and wait for it to return. If it succeeds, it
will return when it does. If it fails, it will raise an exception.
If a maXbox script or app is programmed to assume the host standard, it is always started relative
to the path where the maXbox3.exe as the host itself is:
playMP3(ExePath+'examplesmaxbox.mp3');

So for example you want to run with two boxes, all your external files (we need one file below
mentioned) or resources in a script will be found relative to ExePath():
E:Program Filesmaxboxmaxbox3'examplesZipCodes.txt'

In this case ExePath is E:Program Filesmaxboxmaxbox3.
ExePath is a useful function where you always get the path of maXbox.
If someone tries to start (install) the script or the app to or from a different drive for space or
organizational reasons, it may fail to (install) or to run the script after installation1.

1

You don’t have to install maXbox or a script anyway, just unzip or copy the file
You find all info concerning run environment of the app and script in menu
../Program/Information/……

When Winsock was "ported" to Windows, a problem quickly arose. In Unix it was common to fork
(kind of like multi threading, but with separate processes instead of threads). Unix clients and
daemons would fork processes, which would run, and use blocking sockets. Windows 3.x could
not fork and did not support multi threading.
Using the blocking interface "locked" user interfaces and made programs unresponsive. So
asynchronous extensions were added to WinSock to allow Windows 3.x with its shortcomings to
use Winsock without "locking" the main and only thread of a program. This however required a
different way of programming., and MS and others vilified blocking vehemently so as to mask the
shortcomings of Windows 3.x.
In reality, blocking sockets are the ONLY way Unix does sockets. Blocking sockets also offer
other advantages, and are much better for threading, security, and other aspects. Some
extensions have been added for non-blocking sockets in Unix. However they work quite
differently than in Windows. They also are not standard, and not in wide use. Blocking sockets
under Unix still are used in almost every case, and will continue to be so.
And Blocking has more advantages:
•
•
•

Easy to program - Blocking is very easy to program. All user code can exist in one
place, and in a sequential order.
Easy to port to Unix - Since Unix uses blocking sockets, portable code can be
written easily. Indy uses this fact to achieve its single source solution.
Work well in threads - Since blocking sockets are sequential they are inherently
encapsulated and therefore very easily used in threads.

Hope you did already read Starters 1 till 24 at:
http://sourceforge.net/apps/mediawiki/maxbox/
First we start with the TCP Server and his functionality.
You need the following file ready to download:
http://www.softwareschule.ch/examples/tcpserversocks.zip
After unpacking the namespace you get:
23.05.2013
17.03.2013
29.07.2013
28.07.2013
11.07.2013
11.07.2013

19:54
13:14
23:59
00:39
21:04
19:13

<DIR>
<DIR>
7'370
3'866
9'464
80'096

examples
web
388_TCPServerSockClient.TXT
388_TCPServerSockClient.uc
388_TCPServerSock.TXT
ZipCodes.txt

2
The first project has been designed to be as simple as possible. ZipCode Lookup will allow a
client to ask a server what city and state a zip code is for.
For those of you outside the US who may not know what a zip code is, a zip code is a US
postal code that specifies a postal delivery area. Zip codes are numeric and 5 digits long.
The first step in building a client or server is to understand the protocol. For standard protocols
this is done by reading the appropriate RFC. For ZipCode Lookup a protocol has been defined
and is below.
Most protocols are conversational and plain text. Conversational means that a command is
given, a status response follows, and possibly data. Protocols that are very limited are often not
conversational, but are still plain text. ZipCode Lookup is plain text, but not conversational. Plain
text makes protocols much easier to debug, and also to interface to using different programming
languages and operating systems.
Upon connection the server will respond with a welcome message, then accept a command. That
command can be "ZipCode x" (Where x is the zip code) or "Quit". A ZipCode command will be
responded to with a single line response, or an empty line if no entry exists. Quit will cause the
server to disconnect the connection. The server will accept multiple commands, until a Quit
command is received.
First we create and configure some 2 objects:
procedure TCPServerMain_Create(Sender: TObject);
begin
ZipCodeList:= TStringList.Create;
ZipCodeList.LoadFromFile(ExePath+'Examples'+SFILE);
IdTCPServer1:= TIdTCPServer.Create(self);
with IdTCPServer1 do begin
defaultPort:= TCPPORT;
Active:= true;
onConnect:= @TCPServer_IdTCPServer1Connect;
OnExecute:= @TCPServer_IdTCPServer1Execute;
PrintF('Listening TCPServer on
%s:%d.',[getIP(getHostName),Bindings[0].Port]);
ShowmessageBig('Close OK to shutdown TCP Server listen on:
'+intToStr(Bindings[0].Port));
Active:= false;
Free;
TCPServer_Destroy(self);
end;
Writeln('Server Stopped at '+DateTimeToInternetStr(Now, true))
end;

The only parts that are Indy specific are the IdTCPServer1 component, IdTCPServer1Connect
method, and the IdTCPServer1Execute method.
The String list represents a data Container as a key – value dictionary.
IdTCPServer1 is a TIdTCPServer and is a component on the form. The following properties
were altered from the default:
3
•
Active = True - Set the server to listen when the application is run.
•
DefaultPort = 6000 - An arbitrary number for this demo.
This is the port the listener will listen on for incoming client requests.
The IdTCPServer1Execute method is hooked to the OnExecute event of the server. The
OnExecute event is fired by the server after a client connection has been accepted. The
OnExecute event is uniquely different from other events you may be familiar with. OnExecute is
executed in the context of a thread.
The thread the event is called from is passed in the AThread argument of the method. This is
important as many OnExecute events may be executing at the same time. This was done with an
event so that a server could be built without the requirement of building a new component. There
are also methods that can be overridden when descendant components are created.
The OnConnect is called after a connection has been accepted, and a thread created for it. In
this server it is used to send the welcome message to the client. This could also be done in the
OnExecute event if desired.
The OnExecute event will be called repeatedly until the connection is disconnected or broken.
This eliminates the need to check the connection and loop inside the event.
Indy server components create a listener thread that is separate from the main thread of the
program. The listener thread listens for incoming client requests. For each client that it answers, it
then spawns a new thread to service that client. The appropriate events are then fired within the
context of that thread.

Many Listener Threads Step by Step

IdTCPServer1Execute uses two basic Indy functions, ReadLn and WriteLn. ReadLn reads a
line from the connection and WriteLn writes a line to the socket stream connection.
sCommand:= ReadLn('',1000,80);

The above line reads the command with 3 specific optimisations from the client and puts the input
into the local string variable sCommand.

4
if SameText(sCommand, 'QUIT') then begin
Disconnect;
end else if SameText(Copy(sCommand,1,8),'ZipCode ') then begin
WriteLn(ZipCodeList.Values[Copy(sCommand,9,MaxInt)]);
end;

Next the input in sCommand is parsed to see which command the client issued.
If the command is "Quit" the connection is disconnected. No more reading or writing of the
connection is permitted after a disconnect call. When the event is exited after this, the listener will
not call it again. The listener will clean up the thread and the connection.
If the command is "ZipCode" the parameter after the command is extracted and used to look up
the city and state. The city and state is then written to the connection, or an empty string if one a
match for the parameter is not found.
Finally the method is exited. The server will recall the event again as long as the connection is
connected, allowing the client to issue multiple commands.
In this lesson we deal with multiple instances of maXbox and his creation of a TCPClient and a
TCPServer instance. You can create multiple instances of the same app to execute parallel code,
just type <F4>. For example, you can launch a new instance within a script of the box in response
to some user action, allowing each script to perform the expected response.
ShellExecute3(ExePath+'maxbox3.exe',ExePath+'examples'+ascript,secmdopen);

So creating multiple instances results in launching multiple instances of the application and the
scripts too. There’s no good way to launch one application (maXbox) with multiple scripts in it.
Maybe with OLE Automation in that sense you open Office programs (word, excel) or other
external shell objects.
Try also the example of OLE Objects 318_excel_export3.TXT and the tutorial 19.
An external script or a least a second one could also be a test case to compare the behaviour.
Each test case and test project is reusable and rerunnable, and can be automated through the
use of shell scripts or console commands.
Lets now take a look at the Client.
Button1Click is a method that is hooked to the OnClick event of Button1. When the button is
clicked it executes this method. The Indy portion of this method can be reduced to the following:
1.
2.
3.
4.
5.
6.
7.

Connect to Server ( Connect; ) – Instance1 - Server
Read welcome message from the server.
For each line the user entered in the TMemo:
Send request to server ( WriteLn('ZipCode ' + memoInput.Lines[i]); ) Instance2 - Client
Read response from server ( s:= ReadLn; )
Send Quit command ( WriteLn('Quit'); )
Disconnect ( Disconnect; ) from Sockets:

procedure TCPServer_IdTCPServer1Execute(AThread: TIdPeerThread);
var
sCommand: string;
begin
with AThread.Connection do begin
sCommand:= Readln('',1000,80);
if SameText(sCommand, 'QUIT') then begin

5
Disconnect;
end else if SameText(Copy(sCommand,1,8),'ZipCode ') then begin
WriteLn(ZipCodeList.Values[Copy(sCommand,9,MaxInt)]);
end;
PrintF('Command %s at %-10s received from %s:%d',[sCommand,
DateTimeToStr(Now), socket.binding.PeerIP,
Socket.binding.PeerPort]);
end; {with}
end;
{try

[trye | try except | Borland.EditOptions.Pascal]

| except
end;}

The Function ReadLn (not to confuse with the normal one) takes 3 parameters:
//('Function ReadLn(ATerminator: string; const ATimeout,
AMaxLineLength:Integer):string');

The only parts that are Indy specific are the Client component and the
Button1Click method.

2: TCP Client/Server Script Loaded

Could be that the Server runs forever (no Quit). A standard approach to break a running loop
in a script or configuration is the well known KeyPress or IsKeyPressed function you can check:
6
procedure LoopTest;
begin
Randomize;
REPEAT
Writeln(intToStr(Random(256*256)));
UNTIL isKeyPressed; //on memo2 output
if isKeypressed then writeln(Key has been pressed!');
end;

As you know the memo2 is the output window as the shell, so the keypress is related to memo2;
by the way memo1 is still the editor!
With another function KeyPressed(VK: Integer): Boolean; returns True, if key VK has
been pressed.
Client is a TIdTCPClient and is a component in the app. The following properties were altered
from the default:
•
•

Host = 127.0.0.1 - Host was set to contact a server on the same machine as the
client (or set by 192.168.1.53).
Port = 6000 - An arbitrary number for this demo. This is the port that the client will
contact the server with.

procedure TCPMain_Connect1Click(Sender: TObject);
begin
//butnLookup.Enabled:= true;
client:= TIdTCPClient.create(self);
client.host:= TCPHOST; //'127.0.0.1';
client.port:= TCPPORT;
try
with Client do begin
Connect(2000); try
//lboxResults.Items.Add(ReadLn());
memo2.lines.add(ReadLn('',1000,80));

//hello from TCP

//for i:= 0 to memoInput.Lines.Count-1 do begin
for i:= 01001 to 01013 do begin
WriteLn('ZipCode ' + '0'+inttoStr(i));
//
ip_port:= ReadInteger('Web','IPPORT',0);
finally
writeln('inifile sysdata2: '+boot_conf+':'+intToStr(ip_port));
Free;
end;
end;

This process is handled directly, through an object so each time it changes ReadLn of the
connection also and not on demand.
An Internet socket is characterized by a unique combination of the following:
7
•
•

•

Local socket address: Local IP address and port number
Remote socket address: Only for established TCP sockets. As discussed in the
client-server section below, this is necessary since a TCP server may serve
several clients concurrently. The server creates one socket for each client, and
these sockets share the same local socket address from the point of view of the
TCP server.
Protocol: A transport protocol (e.g., TCP, UDP, raw IP, or others). TCP port 53
and UDP port 53 are consequently different, distinct sockets.

In other words within the operating system and the application that created a socket, a socket
is referred to by a unique integer number called socket identifier or socket number. The operating
system forwards the payload of incoming IP packets to the corresponding application by
extracting the socket address information from the IP and transport protocol headers and
stripping the headers from the application data.

1.2 Telnet Testing
These demos were pre-tested and will work as long as TCP/IP is installed and active on your
system. You can change this to run across the network from one computer to another by running
the server on another computer and changing the host property of the client to the IP or TCP/IP
name of the machine the server is running on. Otherwise it will look for the server on the same
computer as the client.
To test the projects, compile and run the server script. Then compile and run the client script.
Enter a zip code(s) into the memo field or direct in code on the left and click lookup.
Plain text protocols can be debugged easily because they can be tested using a telnet session.
To do this you merely need to know what port the server is running on. Zip Code Lookup Server
listens on port 6000.
Run ZipCode Lookup Server Script again. Next open a command window (a.k.a Dos Box
Window). Now type on the shell (picture 4):
telnet 127.0.0.1 6000 <enter>
or telnet 192.168.1.53 6000 <enter>

You are now connected to the Zip Code Lookup Server. Some servers will greet you with a
welcome message. This one does not at first time then after Echo it does:
>>> Indy Hanoi Zip Code mXServer Ready.

You will not see your keystrokes. Most servers do not echo the commands as it would be a waste
of bandwidth.
You can however change your telnet settings by setting "Echo On". Different telnet clients will call
this feature different things. A few do not even have this option. Now type:
>>zipCode 37642 <enter>

You will see the server respond with:
CHURCH HILL, TN
To disconnect from the server enter:
>>Quit <enter>

Telnet is a network protocol used on the Internet or local area networks to provide a bidirectional
interactive text-oriented communication facility using a virtual terminal connection. User data is
8
interspersed in-band with Telnet control information in an 8-bit byte oriented data connection over
the Transmission Control Protocol (TCP).
In maXbox you can also start with read only mode (Options/Save before Compile), so nothing
will be write on the disk or you can set your webconfig before.
//*** Definitions for maXbox mX3 ***
[WEB]
IPPORT=8080 //for internal webserver – menu /Options/Add Ons/WebServer2
IPHOST=192.168.1.53
ROOTCERT=’filepathY’
//for use of HTTPS and certificates…
SCERT=’filepathY’
RSAKEY=’filepathY’
VERSIONCHECK=Y //checks over web the version

//V 3.9.8.9 also expand macros (see right below) in code e.g. #path or #file: and will cover below.
Try to find out how you get the time from TCP Server:?
Now let’s take a look at the code of the solution:
if SameText(sCommand, 'TIME') then begin
WriteLn(DateTimeToInternetStr(Now, true));

Another idea will be to compare with FTP the whole standard directory with your directory and
check if something on the configuration is missing or damaged. But I think that will going to far.
Something to keep in mind - there are literally hundreds of platform-specific directory listing
formats still being used by FTP servers on the Internet today.
The LIST command outlined in the original FTP specification, RFC 959, did not define any kind of
formatting to be used for listings, so systems were free to use whatever they wanted to use, and
they did do exactly that over the years. Windows and Unix formats are common, but they are not
required.
A formal listing format was not defined until RFC 3659 in the MLSD extension to FTP, which
replaces the old LIST command (TIdFTP.List() does use MLSD if the server supports it).

3: Indy Threads on a TCPServer runs

9
Historically, Telnet provided access to a command-line interface (usually, of an operating system)
on a remote host. Most network equipment and operating systems with a TCP/IP stack support a
Telnet service for remote configuration (including systems based on Win NT).
However, because of serious security issues when using Telnet over an open network such as
the Internet, its use for this purpose has waned significantly in favour of SSH.

4: Telnet in Action

Telnet is a client-server protocol, based on a reliable connection-oriented transport. Typically this
protocol is used to establish a connection to Transmission Control Protocol (TCP) port number
23, where a Telnet server application (telnetd) is listening. Telnet, however, predates TCP/IP
and was originally run over Network Control Program (NCP) protocols.
Check your system environment with GetEnvironmentString:
SaveString(ExePath+'Examplesenvinfo.txt',GetEnvironmentString);
OpenFile(ExePath+'Examplesenvinfo.txt');

1.3 Add The Macro
The only thing you need to know is to set the macros like #host: in your header or elsewhere in
a line, but not two or more on the same line when it expands with content:
Let’s have a look at the demo 369_macro_demo.txt
{*******************************************************************
* Project

: Macro Demo

* App Name: #file:369_macro_demo.txt
* Purpose
* Date

: Demonstrates functions of macros in header

: 21/09/2010

-

14:56

- #date:01.06.2013 16:38:20

10
* #path E:maxboxmaxbox3examples
* #file 369_macro_demo.txt
* #perf-50:0:4.484
* History

: translate/implement to maXbox June 2013, #name@max

*

: system demo for mX3, enhanced with macros, #locs:149

******************************************************************}

All macros are marked with red. One of my favour is #locs means lines of code and you get
always the certainty if something has changed by the numbers of line.
So the editor has a programmatic macro system which allows the pre compiler to be extended by
user code I would say user tags.
Below an internal extract from the help file All Functions List maxbox_functions_all.pdf:
//---------------------------------------------------------------------------10181: //**************mX4 Macro Tags ****************************************
10182: //---------------------------------------------------------------------10183:
10184: #name, ı#date, ı#host, ı#path, ı#file, ı#head, ı#sign, ı#teach
10185:
10186: SearchAndCopy(memo1.lines, '#name', getUserNameWin, 11);
10187: SearchAndCopy(memo1.lines, '#date', datetimetoStr(now), 11);
10188: SearchAndCopy(memo1.lines, '#host', getComputernameWin, 11);
10189: SearchAndCopy(memo1.lines, '#path', fpath, 11);
10190: SearchAndCopy(memo1.lines, '#file', fname, 11);
10191: SearchAndCopy(memo1.lines, '#locs', intToStr(getCodeEnd), 11);
10192: SearchAndCopy(memo1.lines, '#perf', perftime, 11);
10193: SearchAndCopy(memo1.lines, '#head',Format('%s: %s: %s %s ',
10194: [getUserNameWin, getComputernameWin, datetimetoStr(now), Act_Filename]),11);
10195: SearchAndCopy(memo1.lines, '#sign',Format('%s: %s: %s ',
[getUserNameWin, getComputernameWin, datetimetoStr(now)]), 11);
10196: SearchAndCopy(memo1.lines, '#tech',Format('perf: %s threads: %d %s %s',
[perftime, numprocessthreads, getIPAddress(getComputerNameWin),
timetoStr(time)]), 11);

Some macros produce simple combinations of one liner tags but at least they replace the
content by reference in contrary to templates which just copy a content by value.
You can also enhance the API with functions like the example above GetEnvironmentString:
function getEnvironmentString2: string;
var
list: TStringList;
i: Integer;
begin
list:= TStringList.Create;
try
GetEnvironmentVars(list, False);
for i:= 0 to list.Count-1 do
result:= result + list[i]+#13#10;
finally
list.Free;
end;
end;

11

Feedback: max@kleiner.com
Links of maXbox and Socket Programming:
http://www.softwareschule.ch/maxbox.htm
http://sourceforge.net/projects/maxbox
http://sourceforge.net/apps/mediawiki/maxbox/
http://sourceforge.net/projects/delphiwebstart
http://devmentor.org/articles/network/Socket%20Programming%28v2%29.pdf
http://www.atozedsoftware.com/index.en.aspx
http://www.softwareschule.ch/maxbox_mainscreen.png

12
1.4 Appendix

EXAMPLE: List Objects
Working with Lists
The VCL/RTL includes many classes that represents lists or collections of items. They vary depending
on the types
of items they contain, what operations they support, and whether they are persistent.
The following table lists various list classes, and indicates the types of items they contain:

Object Maintains
TList A list of pointers
TThreadList A thread-safe list of pointers
TBucketList A hashed list of pointers
TObjectBucketList A hashed list of object instances
TObjectList A memory-managed list of object instances
TComponentList A memory-managed list of components (that is, instances of classes descended from
TComponent)
TClassList A list of class references
TInterfaceList A list of interface pointers.
TQueue A first-in first-out list of pointers
TStack A last-in first-out list of pointers
TObjectQueue A first-in first-out list of objects
TObjectStack A last-in first-out list of objects
TCollection Base class for many specialized classes of typed items.
TStringList A list of strings
THashedStringList A list of strings with the form Name=Value, hashed for performance.

The ProgID for each of the Shell objects is shown in the following table.
Object
TList
TThreadList
TBucketList
TObjectBucketList
TObjectList
TComponentList
TClassList
TInterfaceList
TQueue
TStack
TObjectQueue
TObjectStack
TCollection
TStringList
THashedStringList

Function
A list of pointers
A thread-safe list of pointers
A hashed list of pointers
A hashed list of object instances
A memory-managed list of object instances
A memory-managed list of components
A list of class references
A list of interface pointers
A first-in first-out list of pointers
A last-in first-out list of pointers
A first-in first-out list of objects
A last-in first-out list of objects
Base class for many specialized classes of typed items
A list of strings
A list of strings with the form Name=Value, hashed for performance.

13

Mais conteúdo relacionado

Mais procurados

Twisted: a quick introduction
Twisted: a quick introductionTwisted: a quick introduction
Twisted: a quick introductionRobert Coup
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...wallyqs
 
Java- Datagram Socket class & Datagram Packet class
Java- Datagram Socket class  & Datagram Packet classJava- Datagram Socket class  & Datagram Packet class
Java- Datagram Socket class & Datagram Packet classRuchi Maurya
 
The TLS/SSLv3 renegotiation vulnerability explained
The TLS/SSLv3 renegotiation vulnerability explainedThe TLS/SSLv3 renegotiation vulnerability explained
The TLS/SSLv3 renegotiation vulnerability explainedThierry Zoller
 
Csphtp1 22
Csphtp1 22Csphtp1 22
Csphtp1 22HUST
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersDenis Kolegov
 
GopherFest 2017 - Adding Context to NATS
GopherFest 2017 -  Adding Context to NATSGopherFest 2017 -  Adding Context to NATS
GopherFest 2017 - Adding Context to NATSwallyqs
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practiceMikalai Alimenkou
 
Debugging Network Issues
Debugging Network IssuesDebugging Network Issues
Debugging Network IssuesApcera
 
Building Distributed Systems
Building Distributed SystemsBuilding Distributed Systems
Building Distributed SystemsPivorak MeetUp
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twistedsdsern
 
Java 8 - Stamped Lock
Java 8 - Stamped LockJava 8 - Stamped Lock
Java 8 - Stamped LockHaim Yadid
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersDenis Kolegov
 
Type of DDoS attacks with hping3 example
Type of DDoS attacks with hping3 exampleType of DDoS attacks with hping3 example
Type of DDoS attacks with hping3 exampleHimani Singh
 
Kalnai_Jirkal-vb-2016-malicious-osx-cocktail
Kalnai_Jirkal-vb-2016-malicious-osx-cocktailKalnai_Jirkal-vb-2016-malicious-osx-cocktail
Kalnai_Jirkal-vb-2016-malicious-osx-cocktailMartin Jirkal
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingOliver Scheer
 

Mais procurados (20)

Proxy
ProxyProxy
Proxy
 
Twisted: a quick introduction
Twisted: a quick introductionTwisted: a quick introduction
Twisted: a quick introduction
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
 
Java- Datagram Socket class & Datagram Packet class
Java- Datagram Socket class  & Datagram Packet classJava- Datagram Socket class  & Datagram Packet class
Java- Datagram Socket class & Datagram Packet class
 
The TLS/SSLv3 renegotiation vulnerability explained
The TLS/SSLv3 renegotiation vulnerability explainedThe TLS/SSLv3 renegotiation vulnerability explained
The TLS/SSLv3 renegotiation vulnerability explained
 
Csphtp1 22
Csphtp1 22Csphtp1 22
Csphtp1 22
 
Tcpsockets
TcpsocketsTcpsockets
Tcpsockets
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache Headers
 
GopherFest 2017 - Adding Context to NATS
GopherFest 2017 -  Adding Context to NATSGopherFest 2017 -  Adding Context to NATS
GopherFest 2017 - Adding Context to NATS
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practice
 
Debugging Network Issues
Debugging Network IssuesDebugging Network Issues
Debugging Network Issues
 
Building Distributed Systems
Building Distributed SystemsBuilding Distributed Systems
Building Distributed Systems
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twisted
 
Ntlm Unsafe
Ntlm UnsafeNtlm Unsafe
Ntlm Unsafe
 
Yet another node vs php
Yet another node vs phpYet another node vs php
Yet another node vs php
 
Java 8 - Stamped Lock
Java 8 - Stamped LockJava 8 - Stamped Lock
Java 8 - Stamped Lock
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache Headers
 
Type of DDoS attacks with hping3 example
Type of DDoS attacks with hping3 exampleType of DDoS attacks with hping3 example
Type of DDoS attacks with hping3 example
 
Kalnai_Jirkal-vb-2016-malicious-osx-cocktail
Kalnai_Jirkal-vb-2016-malicious-osx-cocktailKalnai_Jirkal-vb-2016-malicious-osx-cocktail
Kalnai_Jirkal-vb-2016-malicious-osx-cocktail
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async Programming
 

Destaque

Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Max Kleiner
 
Arduino training program
Arduino training programArduino training program
Arduino training programMax Kleiner
 
Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33Max Kleiner
 
Ekon bestof rtl_delphi
Ekon bestof rtl_delphiEkon bestof rtl_delphi
Ekon bestof rtl_delphiMax Kleiner
 
maXbox starter 34 GPS Tutorial
maXbox starter 34 GPS TutorialmaXbox starter 34 GPS Tutorial
maXbox starter 34 GPS TutorialMax Kleiner
 
maXbox Blix the Programmer
maXbox Blix the ProgrammermaXbox Blix the Programmer
maXbox Blix the ProgrammerMax Kleiner
 
Web_of_Things_2013
Web_of_Things_2013Web_of_Things_2013
Web_of_Things_2013Max Kleiner
 
maXbox starter30 Web of Things
maXbox starter30 Web of ThingsmaXbox starter30 Web of Things
maXbox starter30 Web of ThingsMax Kleiner
 
Clean Code Tutorial maXbox starter24
Clean Code Tutorial maXbox starter24Clean Code Tutorial maXbox starter24
Clean Code Tutorial maXbox starter24Max Kleiner
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching ProgramMax Kleiner
 
Tutorial 37 API Coding
Tutorial 37 API CodingTutorial 37 API Coding
Tutorial 37 API CodingMax Kleiner
 
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19Max Kleiner
 
A 3D printing programming API
A 3D printing programming APIA 3D printing programming API
A 3D printing programming APIMax Kleiner
 
Arduino C maXbox web of things slide show
Arduino C maXbox web of things slide showArduino C maXbox web of things slide show
Arduino C maXbox web of things slide showMax Kleiner
 

Destaque (16)

Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3
 
Arduino training program
Arduino training programArduino training program
Arduino training program
 
Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33Use of an Oscilloscope - maXbox Starter33
Use of an Oscilloscope - maXbox Starter33
 
Ekon bestof rtl_delphi
Ekon bestof rtl_delphiEkon bestof rtl_delphi
Ekon bestof rtl_delphi
 
maXbox starter 34 GPS Tutorial
maXbox starter 34 GPS TutorialmaXbox starter 34 GPS Tutorial
maXbox starter 34 GPS Tutorial
 
maXbox Blix the Programmer
maXbox Blix the ProgrammermaXbox Blix the Programmer
maXbox Blix the Programmer
 
Web_of_Things_2013
Web_of_Things_2013Web_of_Things_2013
Web_of_Things_2013
 
maXbox starter30 Web of Things
maXbox starter30 Web of ThingsmaXbox starter30 Web of Things
maXbox starter30 Web of Things
 
Clean Code Tutorial maXbox starter24
Clean Code Tutorial maXbox starter24Clean Code Tutorial maXbox starter24
Clean Code Tutorial maXbox starter24
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching Program
 
Tutorial 37 API Coding
Tutorial 37 API CodingTutorial 37 API Coding
Tutorial 37 API Coding
 
Maxbox starter
Maxbox starterMaxbox starter
Maxbox starter
 
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19
 
A 3D printing programming API
A 3D printing programming APIA 3D printing programming API
A 3D printing programming API
 
CODEsign 2015
CODEsign 2015CODEsign 2015
CODEsign 2015
 
Arduino C maXbox web of things slide show
Arduino C maXbox web of things slide showArduino C maXbox web of things slide show
Arduino C maXbox web of things slide show
 

Semelhante a TCP Sockets Tutor maXbox starter26

Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18Max Kleiner
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino TutorialMax Kleiner
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginnersEnoch Joshua
 
Java Networking
Java NetworkingJava Networking
Java NetworkingSunil OS
 
maXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazinemaXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazineMax Kleiner
 
Network and Internet Security.docx
Network and Internet Security.docxNetwork and Internet Security.docx
Network and Internet Security.docxstirlingvwriters
 
Design an Implementation of A Messaging and Resource Sharing Software
Design an Implementation of A Messaging and Resource Sharing SoftwareDesign an Implementation of A Messaging and Resource Sharing Software
Design an Implementation of A Messaging and Resource Sharing Softwarenilabarai
 
Mail Server Project Report
Mail Server Project ReportMail Server Project Report
Mail Server Project ReportKavita Sharma
 
Writing Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talkWriting Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talkNATS
 
client-server communication using socket IPC
client-server communication using socket IPCclient-server communication using socket IPC
client-server communication using socket IPCNarayanlalMenariya
 
Black hat 2010-bannedit-advanced-command-injection-exploitation-1-wp
Black hat 2010-bannedit-advanced-command-injection-exploitation-1-wpBlack hat 2010-bannedit-advanced-command-injection-exploitation-1-wp
Black hat 2010-bannedit-advanced-command-injection-exploitation-1-wprgster
 
Linux Inter Process Communication
Linux Inter Process CommunicationLinux Inter Process Communication
Linux Inter Process CommunicationAbhishek Sagar
 
Network Security
Network SecurityNetwork Security
Network SecurityJaya sudha
 
Basics of tcp ip
Basics of tcp ipBasics of tcp ip
Basics of tcp ipKumar
 
1-Information sharing 2-Computation speedup3-Modularity4-.docx
1-Information sharing 2-Computation speedup3-Modularity4-.docx1-Information sharing 2-Computation speedup3-Modularity4-.docx
1-Information sharing 2-Computation speedup3-Modularity4-.docxSONU61709
 

Semelhante a TCP Sockets Tutor maXbox starter26 (20)

Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino Tutorial
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Python networking
Python networkingPython networking
Python networking
 
maXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazinemaXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_Magazine
 
Network and Internet Security.docx
Network and Internet Security.docxNetwork and Internet Security.docx
Network and Internet Security.docx
 
Design an Implementation of A Messaging and Resource Sharing Software
Design an Implementation of A Messaging and Resource Sharing SoftwareDesign an Implementation of A Messaging and Resource Sharing Software
Design an Implementation of A Messaging and Resource Sharing Software
 
Concurrency and parallel in .net
Concurrency and parallel in .netConcurrency and parallel in .net
Concurrency and parallel in .net
 
Mail Server Project Report
Mail Server Project ReportMail Server Project Report
Mail Server Project Report
 
Writing Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talkWriting Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talk
 
client-server communication using socket IPC
client-server communication using socket IPCclient-server communication using socket IPC
client-server communication using socket IPC
 
Black hat 2010-bannedit-advanced-command-injection-exploitation-1-wp
Black hat 2010-bannedit-advanced-command-injection-exploitation-1-wpBlack hat 2010-bannedit-advanced-command-injection-exploitation-1-wp
Black hat 2010-bannedit-advanced-command-injection-exploitation-1-wp
 
Intake 37 12
Intake 37 12Intake 37 12
Intake 37 12
 
Linux Inter Process Communication
Linux Inter Process CommunicationLinux Inter Process Communication
Linux Inter Process Communication
 
Network Security
Network SecurityNetwork Security
Network Security
 
Routing_Article
Routing_ArticleRouting_Article
Routing_Article
 
Basics of tcp ip
Basics of tcp ipBasics of tcp ip
Basics of tcp ip
 
1-Information sharing 2-Computation speedup3-Modularity4-.docx
1-Information sharing 2-Computation speedup3-Modularity4-.docx1-Information sharing 2-Computation speedup3-Modularity4-.docx
1-Information sharing 2-Computation speedup3-Modularity4-.docx
 
NP-lab-manual (1).pdf
NP-lab-manual (1).pdfNP-lab-manual (1).pdf
NP-lab-manual (1).pdf
 

Mais de Max Kleiner

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfMax Kleiner
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfMax Kleiner
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementMax Kleiner
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4Max Kleiner
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87Max Kleiner
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapMax Kleiner
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detectionMax Kleiner
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationMax Kleiner
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_editionMax Kleiner
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingMax Kleiner
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklistMax Kleiner
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP Max Kleiner
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures CodingMax Kleiner
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70Max Kleiner
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIIMax Kleiner
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VIMax Kleiner
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning VMax Kleiner
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3Max Kleiner
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsMax Kleiner
 

Mais de Max Kleiner (20)

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdf
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdf
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_Implement
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmap
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detection
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data Visualisation
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_edition
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklist
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures Coding
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VII
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning V
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_Diagrams
 

Último

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Último (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

TCP Sockets Tutor maXbox starter26

  • 1. maXbox Starter 26 Start with Sockets 1.1 From Socket to Interprocess Communication This Tutorial is based on an article by Chad Z. Hower which he wrote in the days of Indy 8.0 published on swissdelphicenter.ch years ago: http://www.swissdelphicenter.ch/en/showarticle.php?id=4 I did also inherit a bit from the Starter 5 which deals with Internet Programming. Most of the above mentioned article from Chad still applies and is very useful for newer versions of Indy. It shows the implementation of an Indy Server which communicates with a client over TCP and Sockets. I made it scriptable to demonstrate the fascination of 2 boxes communicate with each other at the same time. Indy uses blocking socket calls. Blocking calls are much like reading and writing to a file. When you read data, or write data, the function will not return until the operation is complete. The difference from working with files is that the call may take much longer as data may not be immediately ready for reading or writing (It can only operate as fast as the network or the modem can handle the data). For example, to connect simply call the connect method and wait for it to return. If it succeeds, it will return when it does. If it fails, it will raise an exception. If a maXbox script or app is programmed to assume the host standard, it is always started relative to the path where the maXbox3.exe as the host itself is: playMP3(ExePath+'examplesmaxbox.mp3'); So for example you want to run with two boxes, all your external files (we need one file below mentioned) or resources in a script will be found relative to ExePath(): E:Program Filesmaxboxmaxbox3'examplesZipCodes.txt' In this case ExePath is E:Program Filesmaxboxmaxbox3. ExePath is a useful function where you always get the path of maXbox. If someone tries to start (install) the script or the app to or from a different drive for space or organizational reasons, it may fail to (install) or to run the script after installation1. 1 You don’t have to install maXbox or a script anyway, just unzip or copy the file
  • 2. You find all info concerning run environment of the app and script in menu ../Program/Information/…… When Winsock was "ported" to Windows, a problem quickly arose. In Unix it was common to fork (kind of like multi threading, but with separate processes instead of threads). Unix clients and daemons would fork processes, which would run, and use blocking sockets. Windows 3.x could not fork and did not support multi threading. Using the blocking interface "locked" user interfaces and made programs unresponsive. So asynchronous extensions were added to WinSock to allow Windows 3.x with its shortcomings to use Winsock without "locking" the main and only thread of a program. This however required a different way of programming., and MS and others vilified blocking vehemently so as to mask the shortcomings of Windows 3.x. In reality, blocking sockets are the ONLY way Unix does sockets. Blocking sockets also offer other advantages, and are much better for threading, security, and other aspects. Some extensions have been added for non-blocking sockets in Unix. However they work quite differently than in Windows. They also are not standard, and not in wide use. Blocking sockets under Unix still are used in almost every case, and will continue to be so. And Blocking has more advantages: • • • Easy to program - Blocking is very easy to program. All user code can exist in one place, and in a sequential order. Easy to port to Unix - Since Unix uses blocking sockets, portable code can be written easily. Indy uses this fact to achieve its single source solution. Work well in threads - Since blocking sockets are sequential they are inherently encapsulated and therefore very easily used in threads. Hope you did already read Starters 1 till 24 at: http://sourceforge.net/apps/mediawiki/maxbox/ First we start with the TCP Server and his functionality. You need the following file ready to download: http://www.softwareschule.ch/examples/tcpserversocks.zip After unpacking the namespace you get: 23.05.2013 17.03.2013 29.07.2013 28.07.2013 11.07.2013 11.07.2013 19:54 13:14 23:59 00:39 21:04 19:13 <DIR> <DIR> 7'370 3'866 9'464 80'096 examples web 388_TCPServerSockClient.TXT 388_TCPServerSockClient.uc 388_TCPServerSock.TXT ZipCodes.txt 2
  • 3. The first project has been designed to be as simple as possible. ZipCode Lookup will allow a client to ask a server what city and state a zip code is for. For those of you outside the US who may not know what a zip code is, a zip code is a US postal code that specifies a postal delivery area. Zip codes are numeric and 5 digits long. The first step in building a client or server is to understand the protocol. For standard protocols this is done by reading the appropriate RFC. For ZipCode Lookup a protocol has been defined and is below. Most protocols are conversational and plain text. Conversational means that a command is given, a status response follows, and possibly data. Protocols that are very limited are often not conversational, but are still plain text. ZipCode Lookup is plain text, but not conversational. Plain text makes protocols much easier to debug, and also to interface to using different programming languages and operating systems. Upon connection the server will respond with a welcome message, then accept a command. That command can be "ZipCode x" (Where x is the zip code) or "Quit". A ZipCode command will be responded to with a single line response, or an empty line if no entry exists. Quit will cause the server to disconnect the connection. The server will accept multiple commands, until a Quit command is received. First we create and configure some 2 objects: procedure TCPServerMain_Create(Sender: TObject); begin ZipCodeList:= TStringList.Create; ZipCodeList.LoadFromFile(ExePath+'Examples'+SFILE); IdTCPServer1:= TIdTCPServer.Create(self); with IdTCPServer1 do begin defaultPort:= TCPPORT; Active:= true; onConnect:= @TCPServer_IdTCPServer1Connect; OnExecute:= @TCPServer_IdTCPServer1Execute; PrintF('Listening TCPServer on %s:%d.',[getIP(getHostName),Bindings[0].Port]); ShowmessageBig('Close OK to shutdown TCP Server listen on: '+intToStr(Bindings[0].Port)); Active:= false; Free; TCPServer_Destroy(self); end; Writeln('Server Stopped at '+DateTimeToInternetStr(Now, true)) end; The only parts that are Indy specific are the IdTCPServer1 component, IdTCPServer1Connect method, and the IdTCPServer1Execute method. The String list represents a data Container as a key – value dictionary. IdTCPServer1 is a TIdTCPServer and is a component on the form. The following properties were altered from the default: 3
  • 4. • Active = True - Set the server to listen when the application is run. • DefaultPort = 6000 - An arbitrary number for this demo. This is the port the listener will listen on for incoming client requests. The IdTCPServer1Execute method is hooked to the OnExecute event of the server. The OnExecute event is fired by the server after a client connection has been accepted. The OnExecute event is uniquely different from other events you may be familiar with. OnExecute is executed in the context of a thread. The thread the event is called from is passed in the AThread argument of the method. This is important as many OnExecute events may be executing at the same time. This was done with an event so that a server could be built without the requirement of building a new component. There are also methods that can be overridden when descendant components are created. The OnConnect is called after a connection has been accepted, and a thread created for it. In this server it is used to send the welcome message to the client. This could also be done in the OnExecute event if desired. The OnExecute event will be called repeatedly until the connection is disconnected or broken. This eliminates the need to check the connection and loop inside the event. Indy server components create a listener thread that is separate from the main thread of the program. The listener thread listens for incoming client requests. For each client that it answers, it then spawns a new thread to service that client. The appropriate events are then fired within the context of that thread. Many Listener Threads Step by Step IdTCPServer1Execute uses two basic Indy functions, ReadLn and WriteLn. ReadLn reads a line from the connection and WriteLn writes a line to the socket stream connection. sCommand:= ReadLn('',1000,80); The above line reads the command with 3 specific optimisations from the client and puts the input into the local string variable sCommand. 4
  • 5. if SameText(sCommand, 'QUIT') then begin Disconnect; end else if SameText(Copy(sCommand,1,8),'ZipCode ') then begin WriteLn(ZipCodeList.Values[Copy(sCommand,9,MaxInt)]); end; Next the input in sCommand is parsed to see which command the client issued. If the command is "Quit" the connection is disconnected. No more reading or writing of the connection is permitted after a disconnect call. When the event is exited after this, the listener will not call it again. The listener will clean up the thread and the connection. If the command is "ZipCode" the parameter after the command is extracted and used to look up the city and state. The city and state is then written to the connection, or an empty string if one a match for the parameter is not found. Finally the method is exited. The server will recall the event again as long as the connection is connected, allowing the client to issue multiple commands. In this lesson we deal with multiple instances of maXbox and his creation of a TCPClient and a TCPServer instance. You can create multiple instances of the same app to execute parallel code, just type <F4>. For example, you can launch a new instance within a script of the box in response to some user action, allowing each script to perform the expected response. ShellExecute3(ExePath+'maxbox3.exe',ExePath+'examples'+ascript,secmdopen); So creating multiple instances results in launching multiple instances of the application and the scripts too. There’s no good way to launch one application (maXbox) with multiple scripts in it. Maybe with OLE Automation in that sense you open Office programs (word, excel) or other external shell objects. Try also the example of OLE Objects 318_excel_export3.TXT and the tutorial 19. An external script or a least a second one could also be a test case to compare the behaviour. Each test case and test project is reusable and rerunnable, and can be automated through the use of shell scripts or console commands. Lets now take a look at the Client. Button1Click is a method that is hooked to the OnClick event of Button1. When the button is clicked it executes this method. The Indy portion of this method can be reduced to the following: 1. 2. 3. 4. 5. 6. 7. Connect to Server ( Connect; ) – Instance1 - Server Read welcome message from the server. For each line the user entered in the TMemo: Send request to server ( WriteLn('ZipCode ' + memoInput.Lines[i]); ) Instance2 - Client Read response from server ( s:= ReadLn; ) Send Quit command ( WriteLn('Quit'); ) Disconnect ( Disconnect; ) from Sockets: procedure TCPServer_IdTCPServer1Execute(AThread: TIdPeerThread); var sCommand: string; begin with AThread.Connection do begin sCommand:= Readln('',1000,80); if SameText(sCommand, 'QUIT') then begin 5
  • 6. Disconnect; end else if SameText(Copy(sCommand,1,8),'ZipCode ') then begin WriteLn(ZipCodeList.Values[Copy(sCommand,9,MaxInt)]); end; PrintF('Command %s at %-10s received from %s:%d',[sCommand, DateTimeToStr(Now), socket.binding.PeerIP, Socket.binding.PeerPort]); end; {with} end; {try [trye | try except | Borland.EditOptions.Pascal] | except end;} The Function ReadLn (not to confuse with the normal one) takes 3 parameters: //('Function ReadLn(ATerminator: string; const ATimeout, AMaxLineLength:Integer):string'); The only parts that are Indy specific are the Client component and the Button1Click method. 2: TCP Client/Server Script Loaded Could be that the Server runs forever (no Quit). A standard approach to break a running loop in a script or configuration is the well known KeyPress or IsKeyPressed function you can check: 6
  • 7. procedure LoopTest; begin Randomize; REPEAT Writeln(intToStr(Random(256*256))); UNTIL isKeyPressed; //on memo2 output if isKeypressed then writeln(Key has been pressed!'); end; As you know the memo2 is the output window as the shell, so the keypress is related to memo2; by the way memo1 is still the editor! With another function KeyPressed(VK: Integer): Boolean; returns True, if key VK has been pressed. Client is a TIdTCPClient and is a component in the app. The following properties were altered from the default: • • Host = 127.0.0.1 - Host was set to contact a server on the same machine as the client (or set by 192.168.1.53). Port = 6000 - An arbitrary number for this demo. This is the port that the client will contact the server with. procedure TCPMain_Connect1Click(Sender: TObject); begin //butnLookup.Enabled:= true; client:= TIdTCPClient.create(self); client.host:= TCPHOST; //'127.0.0.1'; client.port:= TCPPORT; try with Client do begin Connect(2000); try //lboxResults.Items.Add(ReadLn()); memo2.lines.add(ReadLn('',1000,80)); //hello from TCP //for i:= 0 to memoInput.Lines.Count-1 do begin for i:= 01001 to 01013 do begin WriteLn('ZipCode ' + '0'+inttoStr(i)); // ip_port:= ReadInteger('Web','IPPORT',0); finally writeln('inifile sysdata2: '+boot_conf+':'+intToStr(ip_port)); Free; end; end; This process is handled directly, through an object so each time it changes ReadLn of the connection also and not on demand. An Internet socket is characterized by a unique combination of the following: 7
  • 8. • • • Local socket address: Local IP address and port number Remote socket address: Only for established TCP sockets. As discussed in the client-server section below, this is necessary since a TCP server may serve several clients concurrently. The server creates one socket for each client, and these sockets share the same local socket address from the point of view of the TCP server. Protocol: A transport protocol (e.g., TCP, UDP, raw IP, or others). TCP port 53 and UDP port 53 are consequently different, distinct sockets. In other words within the operating system and the application that created a socket, a socket is referred to by a unique integer number called socket identifier or socket number. The operating system forwards the payload of incoming IP packets to the corresponding application by extracting the socket address information from the IP and transport protocol headers and stripping the headers from the application data. 1.2 Telnet Testing These demos were pre-tested and will work as long as TCP/IP is installed and active on your system. You can change this to run across the network from one computer to another by running the server on another computer and changing the host property of the client to the IP or TCP/IP name of the machine the server is running on. Otherwise it will look for the server on the same computer as the client. To test the projects, compile and run the server script. Then compile and run the client script. Enter a zip code(s) into the memo field or direct in code on the left and click lookup. Plain text protocols can be debugged easily because they can be tested using a telnet session. To do this you merely need to know what port the server is running on. Zip Code Lookup Server listens on port 6000. Run ZipCode Lookup Server Script again. Next open a command window (a.k.a Dos Box Window). Now type on the shell (picture 4): telnet 127.0.0.1 6000 <enter> or telnet 192.168.1.53 6000 <enter> You are now connected to the Zip Code Lookup Server. Some servers will greet you with a welcome message. This one does not at first time then after Echo it does: >>> Indy Hanoi Zip Code mXServer Ready. You will not see your keystrokes. Most servers do not echo the commands as it would be a waste of bandwidth. You can however change your telnet settings by setting "Echo On". Different telnet clients will call this feature different things. A few do not even have this option. Now type: >>zipCode 37642 <enter> You will see the server respond with: CHURCH HILL, TN To disconnect from the server enter: >>Quit <enter> Telnet is a network protocol used on the Internet or local area networks to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is 8
  • 9. interspersed in-band with Telnet control information in an 8-bit byte oriented data connection over the Transmission Control Protocol (TCP). In maXbox you can also start with read only mode (Options/Save before Compile), so nothing will be write on the disk or you can set your webconfig before. //*** Definitions for maXbox mX3 *** [WEB] IPPORT=8080 //for internal webserver – menu /Options/Add Ons/WebServer2 IPHOST=192.168.1.53 ROOTCERT=’filepathY’ //for use of HTTPS and certificates… SCERT=’filepathY’ RSAKEY=’filepathY’ VERSIONCHECK=Y //checks over web the version //V 3.9.8.9 also expand macros (see right below) in code e.g. #path or #file: and will cover below. Try to find out how you get the time from TCP Server:? Now let’s take a look at the code of the solution: if SameText(sCommand, 'TIME') then begin WriteLn(DateTimeToInternetStr(Now, true)); Another idea will be to compare with FTP the whole standard directory with your directory and check if something on the configuration is missing or damaged. But I think that will going to far. Something to keep in mind - there are literally hundreds of platform-specific directory listing formats still being used by FTP servers on the Internet today. The LIST command outlined in the original FTP specification, RFC 959, did not define any kind of formatting to be used for listings, so systems were free to use whatever they wanted to use, and they did do exactly that over the years. Windows and Unix formats are common, but they are not required. A formal listing format was not defined until RFC 3659 in the MLSD extension to FTP, which replaces the old LIST command (TIdFTP.List() does use MLSD if the server supports it). 3: Indy Threads on a TCPServer runs 9
  • 10. Historically, Telnet provided access to a command-line interface (usually, of an operating system) on a remote host. Most network equipment and operating systems with a TCP/IP stack support a Telnet service for remote configuration (including systems based on Win NT). However, because of serious security issues when using Telnet over an open network such as the Internet, its use for this purpose has waned significantly in favour of SSH. 4: Telnet in Action Telnet is a client-server protocol, based on a reliable connection-oriented transport. Typically this protocol is used to establish a connection to Transmission Control Protocol (TCP) port number 23, where a Telnet server application (telnetd) is listening. Telnet, however, predates TCP/IP and was originally run over Network Control Program (NCP) protocols. Check your system environment with GetEnvironmentString: SaveString(ExePath+'Examplesenvinfo.txt',GetEnvironmentString); OpenFile(ExePath+'Examplesenvinfo.txt'); 1.3 Add The Macro The only thing you need to know is to set the macros like #host: in your header or elsewhere in a line, but not two or more on the same line when it expands with content: Let’s have a look at the demo 369_macro_demo.txt {******************************************************************* * Project : Macro Demo * App Name: #file:369_macro_demo.txt * Purpose * Date : Demonstrates functions of macros in header : 21/09/2010 - 14:56 - #date:01.06.2013 16:38:20 10
  • 11. * #path E:maxboxmaxbox3examples * #file 369_macro_demo.txt * #perf-50:0:4.484 * History : translate/implement to maXbox June 2013, #name@max * : system demo for mX3, enhanced with macros, #locs:149 ******************************************************************} All macros are marked with red. One of my favour is #locs means lines of code and you get always the certainty if something has changed by the numbers of line. So the editor has a programmatic macro system which allows the pre compiler to be extended by user code I would say user tags. Below an internal extract from the help file All Functions List maxbox_functions_all.pdf: //---------------------------------------------------------------------------10181: //**************mX4 Macro Tags **************************************** 10182: //---------------------------------------------------------------------10183: 10184: #name, ı#date, ı#host, ı#path, ı#file, ı#head, ı#sign, ı#teach 10185: 10186: SearchAndCopy(memo1.lines, '#name', getUserNameWin, 11); 10187: SearchAndCopy(memo1.lines, '#date', datetimetoStr(now), 11); 10188: SearchAndCopy(memo1.lines, '#host', getComputernameWin, 11); 10189: SearchAndCopy(memo1.lines, '#path', fpath, 11); 10190: SearchAndCopy(memo1.lines, '#file', fname, 11); 10191: SearchAndCopy(memo1.lines, '#locs', intToStr(getCodeEnd), 11); 10192: SearchAndCopy(memo1.lines, '#perf', perftime, 11); 10193: SearchAndCopy(memo1.lines, '#head',Format('%s: %s: %s %s ', 10194: [getUserNameWin, getComputernameWin, datetimetoStr(now), Act_Filename]),11); 10195: SearchAndCopy(memo1.lines, '#sign',Format('%s: %s: %s ', [getUserNameWin, getComputernameWin, datetimetoStr(now)]), 11); 10196: SearchAndCopy(memo1.lines, '#tech',Format('perf: %s threads: %d %s %s', [perftime, numprocessthreads, getIPAddress(getComputerNameWin), timetoStr(time)]), 11); Some macros produce simple combinations of one liner tags but at least they replace the content by reference in contrary to templates which just copy a content by value. You can also enhance the API with functions like the example above GetEnvironmentString: function getEnvironmentString2: string; var list: TStringList; i: Integer; begin list:= TStringList.Create; try GetEnvironmentVars(list, False); for i:= 0 to list.Count-1 do result:= result + list[i]+#13#10; finally list.Free; end; end; 11
  • 12.  Feedback: max@kleiner.com Links of maXbox and Socket Programming: http://www.softwareschule.ch/maxbox.htm http://sourceforge.net/projects/maxbox http://sourceforge.net/apps/mediawiki/maxbox/ http://sourceforge.net/projects/delphiwebstart http://devmentor.org/articles/network/Socket%20Programming%28v2%29.pdf http://www.atozedsoftware.com/index.en.aspx http://www.softwareschule.ch/maxbox_mainscreen.png 12
  • 13. 1.4 Appendix EXAMPLE: List Objects Working with Lists The VCL/RTL includes many classes that represents lists or collections of items. They vary depending on the types of items they contain, what operations they support, and whether they are persistent. The following table lists various list classes, and indicates the types of items they contain: Object Maintains TList A list of pointers TThreadList A thread-safe list of pointers TBucketList A hashed list of pointers TObjectBucketList A hashed list of object instances TObjectList A memory-managed list of object instances TComponentList A memory-managed list of components (that is, instances of classes descended from TComponent) TClassList A list of class references TInterfaceList A list of interface pointers. TQueue A first-in first-out list of pointers TStack A last-in first-out list of pointers TObjectQueue A first-in first-out list of objects TObjectStack A last-in first-out list of objects TCollection Base class for many specialized classes of typed items. TStringList A list of strings THashedStringList A list of strings with the form Name=Value, hashed for performance. The ProgID for each of the Shell objects is shown in the following table. Object TList TThreadList TBucketList TObjectBucketList TObjectList TComponentList TClassList TInterfaceList TQueue TStack TObjectQueue TObjectStack TCollection TStringList THashedStringList Function A list of pointers A thread-safe list of pointers A hashed list of pointers A hashed list of object instances A memory-managed list of object instances A memory-managed list of components A list of class references A list of interface pointers A first-in first-out list of pointers A last-in first-out list of pointers A first-in first-out list of objects A last-in first-out list of objects Base class for many specialized classes of typed items A list of strings A list of strings with the form Name=Value, hashed for performance. 13