1

When you connect to a WiFi network, the router assigns an IP to the android device (like 192.168.1.105). Now when a FTP or HTTP file server is run on the android device, other devices should type that IP to connect to the server.

This IP is not fixed. When you switch to another WiFi network or enable hot-spot on android itself, it changes.

Is there any way to assign a fixed hostname (for example my-pixel) so other devices could use it instead of the IP (like ftp://my-pixel.local:4030)?

(I also asked this on Stack Overflow but no answer there)

4
  • 1
    Most phones send the name you have configured in About my phone -> Device Name to the DHCP server. The DHCP server in my Wifirouter uses this name and saves it as DNS name for the IP it had assigned to my phone. Just make sure your devices use the DNS server provided by your router and not a "privacy DNS server" from an external system (like Google DNS or Cloudflare DNS).
    – Robert
    Jun 14, 2023 at 13:47
  • 1
    @Robert Thanks, but how does it work? There is a Phone Name that is like Brand Model XX10 (with spaces). Provided that it is connected to the local network how can I, for example, ping this from my computer? Jun 14, 2023 at 14:11
  • 1
    Your computer has to ask your router for the dns name of the local device. If the router is configured to provide DNS services for local devices known by DHCP then it will lookup the phone name in it's DNS table. Note that spaces and underscore are not allowed in DNS, I don't know what happens if your phone tries to use an invalid DNS name. Open up the admin interface of your Wifi router and check what devices it lists and what names it has assigned to them.
    – Robert
    Jun 14, 2023 at 14:34

0

You must log in to answer this question.

Browse other questions tagged .