-1

I created a Server and Client programs using python. The both programs are working fine and were both connected to the same network.. It Tried to test it with different network, but it won't work anymore, since my ip address that I put is my private ip address.... so I change it to public ip address.. but, It still won't work.

I'm using socket module in python

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('49.145.**.**', 8888))

Can anyone please help me how to figure it out.

petezurich
  • 9,280
  • 9
  • 43
  • 57
Concierge
  • 1
  • 3

2 Answers2

0

try to bind it to 0.0.0.0 (all interfaces) to see if it works.

Notice that there's a security issue by listening to all interfaces! make sure you're aware of the implications https://www.ibm.com/support/pages/vulnerability-scan-highlights-0000-http-server-listening-ports

ItayB
  • 10,377
  • 9
  • 50
  • 77
0

Since your application works if both - client and server - are on the same network, the problem can only be a connection problem if you put client and server on different networks.

Does the command telnet <serverip> 8888 succeed from the client's computer? That checks if not only the server is reachable from the client - like a ping command does - but also checks, if the port 8888 can actually be opened as well.

If it isn't working, you need to figure out, which firewall/router might be getting in the way and what routing or port-forwarding is missing on the way between the client's and the server's computer.

For further help, you'd have to give a lot more detail about what "test it with different networks" means in your case.

Frank
  • 884
  • 2
  • 10