如何通过服务器获取客户端之间的连接? [英] How to get connection between clients through server?

查看:76
本文介绍了如何通过服务器获取客户端之间的连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否可能。

我可以在服务器作为中介的两个客户端之间获得全双工连接吗?



例如:

客户端1通过互联网将其套接字连接到客户端2的套接字,以便在单个连接中传输数据。



我希望客户端应用程序是java。

I don't know whether it is possible or not.
Can i get a full duplex connection between two clients with server as intermediary?

For Example:
Client 1 connect its socket to Client 2's Socket through internet for transmission of data in a single connection.

I want client application to be java.

推荐答案

您自己给出了答案,WebSocket是您将用于允许服务器与之通信的API。客户端没有客户端向服务器发送新请求。



这将是一种全双工通信模式,因为服务器和客户端都可以进行通信而无需让其他方从任何一方请求数据并可以按照自己的意愿将数据发送给对方。您可以从 Mozilla开发者网络 [ ^ ]了解其实际概念。
You gave the answer yourself, the WebSocket is the API that you would be using to allow the server to communicate to the client without having the client to send a new request to the server.

It would be a full-duplex communication mode because server and client both can communicate without having other party to ask for data from either side and can send the data to each other as they wish to. You can read more on this from Mozilla Developer Network[^] to understand the actual concept of this.


这篇关于如何通过服务器获取客户端之间的连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆