Android Application listens to TCP port

1k views Asked by At

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 listening to the specific port.

My flow of application is:

First, 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 to listen to following port for port availability.

Can someone enlighten me about this case?

1

There are 1 answers

2
user207421 On

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

There was never any mystery about that. Just try to connect to it.

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

The server is listening to the port. The devices are connected to it.

My flow of application is that,

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

In other words your application connects to the port.

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

Why?

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.

Why?

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.

There is no such thing as 'limit specific number of device in a port'. You can have many thousands of simultaneous connections to the same TCP port. Web servers do this 24 hours a day.

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

Using a single port does not cause congestion or 'bad traffic', and using multiple ports where you could have used one just wastes resources at the server.

There is no point in this. It is based on a serious misunderstanding of TCP.