user2820579
user2820579

Reputation: 3451

Cannot set up local server using external IP

I'm trying to set up two servers on my laptop using the script in https://github.com/misheska/foundations-of-python-network-programming/blob/master/python2/02/udp_remote.py.

As far as I understand, I can set a server just by typing

$ python udp_remote.py server

I want to start another server using my external IP, that I get using:

$ wget -q -O - http://myexternalip.com/raw
XXX.XXX.XXX.XXX

Then the server should be set with

$  python udp_remote.py server XXX.XXX.XXX.XXX

right???

Upvotes: 0

Views: 74

Answers (2)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798456

You cannot bind to an IP address that is not bound to an interface on the computer. If you require port forwarding to be set up on a router then consult your network administrator.

Upvotes: 0

Dan Rice
Dan Rice

Reputation: 630

Your syntax is correct (other than your IP4s being only 3 bytes long), but there are a couple reasons why you're having trouble:

  1. It's not possible to bind to the same port twice on the same interface. Because the script has a fixed port number, you won't be able to run more than one instance unless your laptop has multiple interfaces.
  2. Your WAN IP address will only be resolvable to an interface if your laptop itself is actually assigned that address. If the laptop is connected to a router and is assigned a local address, you won't be able to use the WAN address to specify the interface.

Upvotes: 1

Related Questions