How can I send strings between two computers? [duplicate]

橙三吉。 提交于 2019-12-10 03:41:57

问题


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.


回答1:


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.




回答2:


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).




回答3:


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.



来源:https://stackoverflow.com/questions/8977425/how-can-i-send-strings-between-two-computers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!