Chromebook 上的 Android 应用程序可以创建套接字 TCP 服务器、侦听连接并连接到 LAN 网络上的其他套接字服务器吗?

Can an Androip app on Chromebook create a socket TCP server, listen connections and connect to other socket server on LAN network?

我有一个 android 应用程序,它创建一个套接字 TCP 服务器来侦听来自 windows 应用程序的连接。有时它会连接到 windows app.

上的套接字服务器

它在 android 台设备上正常工作。它还可以接收广播数据包。 但是,当我在 Chromebook 上安装时它不起作用。

它无法侦听任何连接、接收任何数据包或连接到 windows 应用程序上的服务器。

谁能帮我解释原因并指导我解决一些问题?

此致。

我了解 Chromebook 中的网络,发现网络服务发现是此处的解决方案 https://developer.android.com/topic/arc

Check for networking requirements

Chromebooks run the entire Android OS in a container, similar to Docker or LXC. This means that Android will not have direct access to the system's LAN interface. Instead, IPv4 traffic will pass through an internal layer of network address translation (NAT), and IPv6 unicast traffic will be routed through an extra hop. Outbound unicast connections from an Android app to the internet should mostly work as-is; but in general, inbound connections are blocked. Multicast or broadcast packets from Android will not be forwarded to the LAN through the firewall.

As a special exception to the multicast restriction, Chrome OS runs a service that forwards mDNS traffic between Android and the LAN interface, so the standard Network Service Discovery APIs are the recommended way to discover other devices on the LAN segment. After finding a device on the LAN, an Android app can use standard TCP or UDP unicast sockets to communicate with it.

IPv4 connections originating from Android will use the Chrome OS host's IPv4 address. Internally, the Android app will see a private IPv4 address assigned to the network interface. IPv6 connections originating from Android will use a different address from the Chrome OS host, as the Android container will have a dedicated public IPv6 address.