使用 Java 进行 PC 到 PC 通信
有没有这样的东西可以使用JAVA与一台电脑与另一台电脑进行通信。概念与 Window Live Messenger 相同,但只是想知道是否有这样的东西。如果有的话可以举个例子
问候
Is there such thing to communicate with 1 pc to another pc using JAVA. Concept is the same as Window Live Messenger but just want to know if there is such thing. If there is, can give some example
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看一下使用 Jabber 的 Smack API: http://www.igniterealtime.org/projects/smack /
入门指南:
http://www.igniterealtime。 org/builds/smack/docs/latest/documentation/gettingstarted.html
教程:
http://pauldeng.blogspot.com/2009/09/smack-api -tutorial.html
Have a look at the Smack API which uses Jabber: http://www.igniterealtime.org/projects/smack/
Gettting Started Guide:
http://www.igniterealtime.org/builds/smack/docs/latest/documentation/gettingstarted.html
Tutorial:
http://pauldeng.blogspot.com/2009/09/smack-api-tutorial.html
您可以尝试套接字通信,看看java.net包,其中您可以将一台电脑视为服务器Socket,另一台电脑视为客户端Socket。
You can try socket communication, have a look at java.net package, where you can treat one pc as server Socket and another as client Socket.
在最低级别,您将不得不使用 TCP 或 UDP 进行消息交换,因为 Java 还不支持任何其他协议。
您可能想看看 JGroups 项目,它是一个成熟的库,可以帮助您创建网络应用程序。它的基本教程实际上展示了如何实现简单的聊天应用程序。
At the lowest level you are going to have to use TCP or UDP for the message exchange as Java doesn't support any other protocols (yet).
You may want to have a look at the JGroups project, it is mature library that can help you create networked applications. It's basic tutorial actually shows how to implement a simple chat application.
无论使用哪种语言,您都可能会使用一些标准协议(例如 TDC/IP 或 UDP)在应用程序实例之间交换数据。是的,Java 当然支持这些。
Regardless of the language you would probably use some standard protocol like TDC/IP or UDP to exchange data between instances of the application. And yes, Java certainly supports those.