I have a Python server. Each time I change the network the IP changes. I want it to have a static IP over all networks so it can receive data without customizing the code every time. I want to do the same for a Java server too.
Asked
Active
Viewed 218 times
1 Answers
1
Don't use the current IP address in your code. It is standard practice to listen on '0.0.0.0' which will listen on all available servers. You can add the ability to set the listen address from a configuration file and/or the command line. That should solve the issue of having to modify the code every time you change networks.
Getting a static IP address is beyond what I can answer here. It requires a static network. It might be possible to configure a host with a static IP address to forward requests to your server, but the best solution would be to host the server on a host with a static IP address.

BillThor
- 27,737
- 3
- 37
- 69