Unable to access simple server locally, but can access from outside

So, I am involved in creating an Android application and will require information from the server. I created a simple server that just listens on port 65431 for connections, and as soon as the connection is established, it simply writes a line of text.

The problem is that I can test the server from an external network, but everything works fine, however, when I test it from my local network, it is not.

What do I mean on a local network:

  • Server on Macbook IP 192.168.5.111 (not DHCP statically assigned by the router)
  • Have a static IP address from ISP
  • Trying to test the server from a phone connected to home Wi-Fi IP 192.168.5.101
  • When testing localhost, it works, but not a static IP

When I test my phone, the connection is not made. Any thoughts?

+4
source share
1 answer

Your server will be bound to the static IP address you mentioned. Install the server to run on IP 0.0.0.0and everything done.

Verify access using the following command on the server:

telnet <ip-address> <port>

+2
source

Source: https://habr.com/ru/post/1606887/


All Articles