Is It Possible For A Server To Be Truly Portable?

Hey guys,

Here’s a quick question: If I setup a static ip address for my phone in order to use it as a server, will it still work as a server if I connect to a different router?

My thought process is that it won’t work because the new router won’t have the static ip address, and if anything I would have to reset the static ip address. Because of this, it is not guaranteed that my server will have the same ip address if it is connected to a different router. Am I correct?

Also, how do I get a public ip address (not domain name, I just need other applications to be able to connect to my phone)? Is it possible to get one for free?

Thanks for your help!

Here’s one possibility to consider.

First, set up a permanent fixed server, with an API listening for your phone to ping it. If your phone’s IP should change, assuming you’re passing some sort of token to validate that your phone is, in fact, your phone.

When your phone pings that API, the IP would be passed in, and if it’s different from that stored in the fixed server’s database, it could simply log your phone’s current IP, regardless of which router/network you’re on.

Then, when users you want ping the fixed server’s API to find your phone, that fixed server would simply respond with the current IP of your phone itself. They could then connect to that IP, and thus to your phone.

Of couse, if you’re (for example) at a local library or coffeeshop, it won’t work as you expect. If you’re in a place where you’re being assigned a LAN IP (a local network, usually a hub that connects to a router), that is a shared connection - the internal network could have dozens or hundreds of IPs within their internal network, being passed through a single IP on the external side. The router would need to be set up to direct traffic to your specific server each time.

Other option…

If your phone plan allows you to set up your phone as a ‘Wifi Hotspot’, then you should have no problem setting up a fixed IP to your phone. Might make sense to talk to your phone provider about that, as they would be the ones assigning you an IP.

Yeah, that’s what I was talking about.

Is this instead of pinging the fixed server, or is this how I would ping the fixed server?

How would I ping the fixed server? Is there another way I’m not aware of to have internet other than being assigned a LAN IP by a router?

This is a pretty advanced topic. You would need to set up a server with a fixed known URL or IP. For testing purposes, you might find something like Google’s Firebase a very useful place to start. You could not only set up the server-side application there, but you could host the data there as well.

What sort of server software are you considering running on your phone? Are you thinking a light version of (for example) node? If so, you could have a background app on your phone that simply scans for a change in internet connection status and, when that has changed, auto-connects to that (for example) firebase app. When it connects, the server side would parse the connection request, getting the IP and/or authentication needed to allow your phone to connect, and save that IP to its own database.

As I said, this is by no means a trivial subject, and one I am really not an expert on. I’m mostly giving suggestions for directions you might consider. The most reliable, stable option to consider would be assuming your phone provider can give you a fixed IP. SOOO much easier.

I see…

Yeah, I am currently trying to better understand how the internet works and whatnot. I have heard that you could host a wbesite from your phone, but that originally didn’t make sense to me based on how I thought ip addresses work. Also, I wanted to see if I could write a python application to track the location of my laptop (from my phone).

This information has been helpful, thanks