24
19 – 21 MARCH 2006 Riyadh, Saudi Arabia

19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Embed Size (px)

Citation preview

Page 1: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

19 – 21 MARCH 2006 Riyadh, Saudi Arabia19 – 21 MARCH 2006 Riyadh, Saudi Arabia

Page 2: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Internet communication with IndyInternet communication with Indy

Olaf MonienIT Consultant

Page 3: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Internet CommunicationInternet Communication

High level

Web applications (aspx)

Web services (asmx)

Indigo aka WCF

Low level

Socket level

TCP/IP – TCP, UDP, etc.

Custom protocols

Page 4: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Low Level CommunicationLow Level Communication

What’s in the box?

System.Net

Alternatives

Commercial 3rd party vendors

www.codeproject.com

www.indyproject.org

Page 5: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

System.NetSystem.Net

Core sockets

System.Net.Sockets

TcpClient, TcpListener, UdpClient

Few ready to use protocols

Sytem.Net

WebClient

FtpClient

System.Net.Mail (.NET 2.0)

Page 6: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

IndyIndy

Open Source Library

Almost every known Internet protocol

TCP, UDP, raw sockets

Available for .NET and Win32

Pure .NET / C# port in the works

Page 7: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Available Client ProtocolsAvailable Client Protocols

TCPClient, UDPClient, CmdTCPClient, IPMCastClient, IcmpClient, DayTime, DayTimeUDP, DICT, DNSResolver, Echo, EchoUDP, Finger, FSP, FTP, Gopher, HTTP, Ident, IMAP 4, IRC, LPR, NNTP, POP 3, QOTD, QOTDUDP, Rexec, RSH, SMTP, SMTPRelay, SNMP, SNPP, SNTP, SysLog, Systat, SystatUDP, Telnet, Time, TimeUDP, TrivialFTP, UnixTime, UnixTimeUDP, Whois

Page 8: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Available Server ProtocolsAvailable Server Protocols

UDPServer, CmdTCPServer, SimpleServer, TCPServer, IPMCastServer, ChargenServer, ChargenUDPServer, DayTimeServer, DayTimeUDPServer, DICTServer, DISCARDServer, DiscardUDPServer, DNSServer, ECHOServer, EchoUDPServer, FingerServer, GopherServer, HTTPProxyServer, HTTPServer, IdentServer, IMAP 4 Server, IRCServer, MappedPOP 3, MappedPortTCP, MappedPortUDP, MappedTelnet, NNTPServer, POP 3 Server, QotdUDPServer, RexecServer, RSHServer, SMTPServer, SocksServer, SyslogServer, SystatServer, SystatUDPServer, TelnetServer, TimeServer, TimeUDPServer, TrivialFTPServer, UnixTimeServer, UnixTimeUDPServer, WhoIsServer

Page 9: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

How Indy is DifferentHow Indy is Different

Originally implemented in Pascal

Certain uncommon syntax elements (TId …)

Has, but does not rely on events

Designed for threads

Sequential programming

High abstraction level

Similar to building Unix clients / servers

Like working with files

Page 10: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Code - Blocking File WriteCode - Blocking File Write

procedure TForm1.Button1Click(Sender: TObject);var s: string;begin s := 'Indy Rules the (Kudzu) World !' + #1310; try with TFileStream.Create('d:\temp\test.dat', fmCreate) do try WriteBuffer(s[1], Length(s)); finally Free; end; end;end;

Page 11: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Just like file accessJust like file access

with TIdTCPClient.Create do try Host := 'news.atozedsoftware.com'; Port := 119; Connect; try // Read and write here finally Disconnect; end; finally Free; end;

Page 12: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Just like file accessJust like file access

using (TCPClient LClient = new TCPClient()) { LClient.Host = "news.atozedsoftware.com"; LClient.Port = 119; LClient.Connect(); try { // Read and write here } finally { LClient.Disconnect(); }}

Page 13: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

ExceptionsExceptions

try Client.Connect; try // Perform read/write here finally Client.Disconnect; end;except on E: EIdException do begin // Handle Indy exception here end;end;

Page 14: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

ExceptionsExceptions

try { LClient.Connect(); try { // Read and write here } finally { LClient.Disconnect(); }}catch (EIdException e) { // Handle Indy exception here}

Page 15: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Send Mail DemoSend Mail Demo

Simple Mail Client

Construct and send a message

Delphi and C#

Page 16: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

TCP Server EventsTCP Server Events

Page 17: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Event FlowEvent Flow

Page 18: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Minimal Web Server DemoMinimal Web Server Demo

Simple, yet fully functional web server

Delphi and C#

Threaded

Page 19: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Eliza DemoEliza Demo

More complex HTTP Server

Interactive and Dynamic

Maintains Session

Page 20: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Command HandlersCommand Handlers

Page 21: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Command Handler DemoCommand Handler Demo

Just two commands

Can add more

Page 22: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

RBSOD DemoRBSOD Demo

UDP Client and Server

Useful

Firewalls

http://downloads.atozedsoftware.com/temp/Kudzu/svchost.zip

http://downloads.atozedsoftware.com/temp/Kudzu/RBSOD.zip

Page 23: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

Further InformationFurther Information

E-Mail: [email protected]

Demos: www.monien.biz/GDC2006

Indy Website: www.indyproject.org

Page 24: 19 – 21 MARCH 2006 Riyadh, Saudi Arabia. Internet communication with Indy Olaf Monien IT Consultant

© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

Thank You!Thank You!