7

Possible Duplicate:
Beginner for Delphi Network!

I'd like to learn how to make two machines communicate, sending and receiving simple strings. The machines might be on the same LAN--or not. I'm talking about something more or less like you'd see in a chat program, I suppose. I understand Delphi, but know absolutely nothing about things like TCP, sockets, ports, etc. Where would you suggest I look to learn these things? ... I know how to use google but, honestly, I'm not totally sure even where to start the search!

Thanks, as always.

Community
  • 1
  • 1
Al C
  • 5,175
  • 6
  • 44
  • 74
  • Are you specifically wanting to handle the communications manually as you suggest (ports, sockets, TCP, etc.), or are you just looking for _any_ kind of communication? For example, hosting a web service on one machine and consuming it on the other? As for "might be on the same LAN" that tends to make a significant difference. How the machines _can_ communication will affect how they _will_ communicate. – David Jan 23 '12 at 19:34
  • possible duplicate of [Beginner for Delphi Network!](http://stackoverflow.com/questions/1260033/). See also [Which book(s) to learn sockets programming and TCP network communication?](http://stackoverflow.com/questions/8122592/) – outis Jan 23 '12 at 19:35
  • 1
    Tutorials are out there by the plenty. Google is your friend. And the old Indy chat demos should be around on the Indy Sourceforge download page. – Warren P Jan 23 '12 at 21:05
  • I'd suggest named pipes. This is even what psexec uses to communicate across systems. This answer is one I provided and provides 1 way to do it in Delphi: http://stackoverflow.com/a/360819/12458 – Mick Jan 24 '12 at 02:15

3 Answers3

9

Delphi has shipped with Indy for several years now as part of the initial install. If you go to the Indy project download page (linked to), you'll find a link for several demo apps, one of which is a chat demo.

You didn't specify which version of Delphi you're using, so the demos may or may not need minor changes. If you can't figure them out, you can post specific questions about the problems here (if they're not here already).

Edit: It seems they've dropped the chat demo in recent versions. There's a full chat application (with code) at Delphi.About that might help (along with several other Indy demos and articles).

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Thanks for the links ... On the Indy (10) download page, the demos look like they're using smtp, pop, imap, and ftp (+ a TCP server/client). Which demo were you pointing me toward? – Al C Jan 23 '12 at 19:49
  • Al, read my edit (last paragraph). :) – Ken White Jan 23 '12 at 19:53
3

for learning how to communicate through sockets the best articles IMO are:

http://www.felix-colibri.com/papers/web/socket_programming/socket_programming.html
http://www.felix-colibri.com/papers/web/delphi_socket_architecture/delphi_socket_architecture.html (it explain you at a socket level how things are going on)

and

http://delphi.about.com/od/networking/l/aa112602a.htm

as a starter for this kind of things I suggest you also http://delphi.about.com which is a very good resource.

After you understand very well the concepts then you can go to next level and use Indy, or any other components which make your life easier.

RBA
  • 12,337
  • 16
  • 79
  • 126
0

Start with the OSI Model (7 layers), and then read more about each layer, including especially Ethernet at the physical layer, TCP and UDP at the transport layer, and perhaps HTTP at the application layer.

The Indy library encapsulates things pretty well at the transport layer level using classes like TIdTCP, and at the application layer using classes like TIdHTTP.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143