tags:

views:

20

answers:

2

Hi all, I was looking at the API, and Ive tried to determine this:

On a given port, check if it's available or already some application listens to it.

Thanks,

ray.

A: 

If you are binding on a specific port, then there is probably something wrong with your Android code; most likely, you should only make outbound connections. If you need to communicate to some other Android device, consider having both devices connect to a common web service that bridges the connection. Using a web service as an intermediary decouples the connection between the devices and also avoids common problems where routers or firewalls block incoming connections.

Michael Aaron Safyan
I`am willing to listen to some port, why is it a problem?
rayman
@rayman, it isn't a problem, but it is highly unusual. Keep in mind that if you are behind a NAT router, for example, you might not be able to receive incoming traffic.
Michael Aaron Safyan
But, is there anyway to determine which ports, (or specific one) are open?
rayman
A: 

The Ive found a way to check it.

By using SocketConnecton, and open it on the request port, if it's not available an IO Exception will be thrown.

rayman