[英]Is it possible to create connection (websocket?) from mobile phone to java on desktop?
I would like to send data directly from my Android phone to Java in the web browser on my desktop.我想在桌面上的 web 浏览器中将数据直接从我的 Android 手机发送到 Java。 Both devices may not be on the same su.net.两个设备可能不在同一个 su.net 上。 Is it actually possible, or do the both devices first need to connect to a common server on the Inte.net that relays the data between two websockets ?这实际上是可能的,还是这两个设备首先需要连接到在两个websocket之间中继数据的 Inte.net 上的公共服务器?
Since both applications (browser + app) are both websocket clients, you need a third application acting as the websocket server.由于两个应用程序(浏览器 + 应用程序)都是 websocket 客户端,因此您需要第三个应用程序充当 websocket 服务器。 This third application has to offer the websocket(s) that both applications connect to ws://third-app/socket
.第三个应用程序必须提供两个应用程序都连接到ws://third-app/socket
的 websocket。
If this app is running locally in your.network or on a server on the Inte.net is up to you.此应用程序是在您的网络中本地运行还是在 Inte.net 上的服务器上运行由您决定。 But if both devices are in different su.nets your firewalls/routers have to ensure that both devices can reach the websocket server.但是如果两个设备都在不同的 su.net 中,您的防火墙/路由器必须确保两个设备都可以到达 websocket 服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.