Python socket bind to any IP?

If you want to bind to all available IPv4 addresses, specify 0.0.0.0 as your IP address. If you’re behind a router and wish to have your socket internet-accessible, rather than just available on your LAN, you’ll need to set up a port forwarding rule so that users outside your LAN can access the service.

See the following ServerFault question for more info on 0.0.0.0: https://serverfault.com/questions/78048/whats-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1

Leave a Comment