简体   繁体   English

Java中的安全Messenger

[英]Secure Messenger in Java

While creating a Secure Instant messenger in java , if there are many clients for example 3 clients client A,B,CA wants to connect to B and C both. 在Java中创建Secure Instant Messenger时,如果有很多客户端,例如3个客户端,则客户端A,B,CA都希望同时连接到B和C。 So do i need to create different socket connection for both of them separately? 那么我需要分别为它们创建不同的套接字连接吗? If so than is not it is a restriction like if there are 10,000 clients and each wants to connect to rest of them so i will need million ports? 如果不是这样的话,这是一个限制,例如是否有10,000个客户端,每个客户端都想连接到其余客户端,因此我将需要数百万个端口?

Yes, your solution would work. 是的,您的解决方案将起作用。 But when you add many more users, the instant messager will lag and be hard to maintain. 但是,当您添加更多用户时,即时消息传递程序将滞后并且难以维护。

The better solution is to have one connection for each client, a connection to a server. 更好的解决方案是为每个客户端建立一个连接,即与服务器建立连接。 clients will connect to this server (which will also handle authentication), and the server will sort out the messages and deliver them to another client(the messages destination). 客户端将连接到该服务器(该服务器还将处理身份验证),并且服务器将整理消息并将其传递到另一个客户端(消息目标)。

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

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