Skip to content Skip to sidebar Skip to footer

Python Public Ip With Sockets (err:cannot Assign Requested Addr)

After allowing my raspberry pi to access port 9999 of my router socketname.bind(96.231.140.202,9999) in python gives me a cannot assign error To port forward I used: myfiosgatew

Solution 1:

You cannot bind to your public IP. Your router is doing that. You instead want to bind to your private IP and port forward traffic destined to 9999 to your bound IP on your pi, this address will fall into the rfc compliant private IP ranges, so it will most likely be something like 192.168.1.12 or something similar.

For example:

socketname.bind(0.0.0.0,9999) #the use of 0.0.0.0 will automatically find your available interface on that raspberry pi.

If you let me know exactly what socket library youa re using I can craft the exact code.

Post a Comment for "Python Public Ip With Sockets (err:cannot Assign Requested Addr)"