有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Android应用程序监听TCP端口

我已经知道了如何检查服务器上的端口是否打开

然而,我面临一个问题,即如何检查监听特定端口的其他设备的数量

我的申请流程是:

首先,我的应用程序将检查服务器的端口是否打开

其次,如果端口是打开的,它将需要检查侦听TCP端口的设备数量

第三,如果端口达到特定数量,比如说20个设备监听TCP端口,我需要应用程序监听以下端口以获得端口可用性

有人能告诉我这个案子吗


共 (1) 个答案

  1. # 1 楼答案

    I have figured out how to check if the Port is open or not in my server.

    这一点从来没有什么神秘之处。试着连接它

    However, I am facing an issue that how to check the numbers of other devices is listening to the specific port.

    服务器正在监听端口。设备已连接到它

    My flow of application is that,

    Firstly, my application will check if my server's port is open or not.

    换句话说,应用程序连接到端口

    Second, if the port is open, it will need to check the number of devices listening to the TCP port.

    为什么

    Third, if port reach specific number, lets say 20 devices listening to the TCP port, I will need the application listen to following port for port availability.

    为什么

    I have around 3000 devices will be connecting to the port and limit of 20 is just an example of limit specific number of device in a port.

    没有“限制端口中特定数量的设备”这样的事情。您可以同时有数千个连接到同一TCP端口。网络服务器每天24小时都这样做

    I try to avoid congestion or bad traffic by having multiple ports availability for devices.

    使用单个端口不会导致拥塞或“坏流量”,而使用多个本可以使用一个端口的端口只会浪费服务器上的资源

    这没有意义。这是基于对TCP的严重误解