简体   繁体   English

使用Java进行PC到PC的通信

[英]PC to PC communication using Java

Is there such thing to communicate with 1 pc to another pc using JAVA. 是否有这样的东西可以使用JAVA与1台计算机通信到另一台计算机。 Concept is the same as Window Live Messenger but just want to know if there is such thing. 概念与Window Live Messenger相同,但只想知道是否存在这种情况。 If there is, can give some example 如果有,可以举个例子


Regards 问候

您可以尝试套接字通信,看看java.net包,在其中可以将一台PC视为服务器Socket,将另一台PC视为客户端Socket。

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). 在最低级别上,您将不得不使用TCP或UDP进行消息交换,因为Java还不支持任何其他协议。

You may want to have a look at the JGroups project, it is mature library that can help you create networked applications. 您可能想看看JGroups项目,它是成熟的库,可以帮助您创建联网的应用程序。 It's basic tutorial actually shows how to implement a simple chat application . 它的基本教程实际上显示了如何实现简单的聊天应用程序

Regardless of the language you would probably use some standard protocol like TDC/IP or UDP to exchange data between instances of the application. 无论使用哪种语言,您都可能会使用某些标准协议(例如TDC / IP或UDP)在应用程序实例之间交换数据。 And yes, Java certainly supports those. 是的,Java当然支持这些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM