Upload
bruno-gaines
View
223
Download
0
Tags:
Embed Size (px)
Citation preview
19 – 21 MARCH 2006 Riyadh, Saudi Arabia19 – 21 MARCH 2006 Riyadh, Saudi Arabia
Internet communication with IndyInternet communication with Indy
Olaf MonienIT 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
Low Level CommunicationLow Level Communication
What’s in the box?
System.Net
Alternatives
Commercial 3rd party vendors
www.codeproject.com
www.indyproject.org
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)
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
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
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
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
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;
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;
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(); }}
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;
ExceptionsExceptions
try { LClient.Connect(); try { // Read and write here } finally { LClient.Disconnect(); }}catch (EIdException e) { // Handle Indy exception here}
Send Mail DemoSend Mail Demo
Simple Mail Client
Construct and send a message
Delphi and C#
TCP Server EventsTCP Server Events
Event FlowEvent Flow
Minimal Web Server DemoMinimal Web Server Demo
Simple, yet fully functional web server
Delphi and C#
Threaded
Eliza DemoEliza Demo
More complex HTTP Server
Interactive and Dynamic
Maintains Session
Command HandlersCommand Handlers
Command Handler DemoCommand Handler Demo
Just two commands
Can add more
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
Further InformationFurther Information
E-Mail: [email protected]
Demos: www.monien.biz/GDC2006
Indy Website: www.indyproject.org
© 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!