If you were to implement a persistent tcp connection on android what port number would you choose?
This is the sort of connection used by Google's C2DM service.
If you were to implement a persistent tcp connection on android what port number would you choose?
This is the sort of connection used by Google's C2DM service.
Use any port really. It probably doesn't really matter so long as it's above 1024. Let's say you choose port 5000.
I'd recommend using a second ip address and forward all traffic on ip2:80 to ip1:5000. That way you can get around any firewall restrictions on your network.
If you want more details about adding a second ip address and adding a NAT to your iptables to forward traffic from port 80 on ip2 to port 5000 on ip1, I can share my notes with you.
Technically it really doesn't matter what port you choose. You just can't use a port that is needed for another service if you also want to run this service. So if you want to run it on a mail server, port 25 is a bad choice.
But since there are sometimes firewalls in place that may filter traffic, I'd recommend port 443 (https) where you have a slightly higher chance of getting your traffic through.