0

So I have been developing and android application for fun in my spare time. This application opens a connection to my home server which is running a java program, does some calculations and sends a response. The issue is I do not want to use port 80. If the cell phone is on WiFi I can connect using any port that I would like, say 8080. This works from any WiFi connection even outside of my home network. However switch to 4G and the connection fails.

SERVER:8080

  • Phone on WiFi(ANY) - Works
  • Phone on 4G - Fails



SERVER:80

  • Phone on WiFi(ANY) - Works
  • Phone on 4G - Works


I switched my server over to listen on port 80 and my app to connect using the same and now the connection works on both 4G and WiFi.

Is there something I am missing to make it work on an uncommon port?

Or is this a limitation of 4G connections.

Thanks

2 Answers2

2

I can assure you it's not an issue with 4G which is just IP connectivity. Ports are part of UDP/TCP and are just "data" to the IP network.

However, it is possible that your cellular provider has a firewall that prevents traffic to certain ports. The PortQuiz public website listens on all ports. Using the browser on your phone, try connecting to various ports and see what is successful and what is not.

http://portquiz.net:8080 
http://portquiz.net:8 
http://portquiz.net:666 

If you can connect via WiFi but not Cellular, then your provider is doing things they really shouldn't.

If the browser can connect to port 8080 of your server and your app cannot, then it's something to do with your app.

Brian White
  • 8,332
  • 2
  • 43
  • 67
  • Thank you Brian for your response and pointers. I was able to connect via 4G and port 8080 and received a response from my server in my phones browser. I will have to look into my TCP connection in my application and see if I can do something different. – Tim Van Prooyen Apr 10 '15 at 21:24
  • I have to say... I can't see why you would be able to connect on port 80 and not 8080, especially since it's working for you on WiFi. There's nothing really special about the port number. Perhaps you should include some code and `adb log` output. – Brian White Apr 10 '15 at 21:44
  • @TimVanProoyen - Can you share the response code you are getting - this might help explain the issue. – Mick May 20 '15 at 11:33
0

I had the exact same problem - middleware services running on "non-standard" ports, such as 8081, 8082, 8997, .. and for the love of me, I couldn't access them from my phone, but only IF I had been connected to celluar network. I kept getting 504, gateway timeout.

I ran tcpdump on my linux server, where I had been running my microservices and didn't even see any inbound traffic, so I knew problem had to be somewhere before that.

The interesting thing, however, if I made hotstop from another phone using the same provider and then connected to that hotstop via WiFi, it worked. So it cannot be provider specific.

Anyhow, to anyone else having this same problem - yes, it's indeed that some port numbers are simply not allowed if connected to celluar.

MrKespr
  • 31
  • 1
  • 4