Local sync: why does it work with IP and not with hostname

I am using a enterprise network where my Server (=my desktop PC) does not have a fixed IP Adress.
So I would like to use the hostname instead.

On the Server this seems to Work, I get API is up listening at [hostname]:11111

But on the mobile client I get a connection error.
If I use the ipv4 Adress on both sides it works.

Using the IP on the mobile and hostname on the server doesn’t work.
(This would save me at least one manual IP change).
How comes this, Name resolution on the desktop definitly works.
On the android device I had no Idea how to check.
Isn’t IP and hostname finally pointing to the same place ?

To compare network functionality both devices should be in the same network. So is your phone in the same Wi-Fi network, like your desktop?

Your phone probably uses other nameserver settings. The nameserver ist the server that translates hostname to IP addresses.

Did you try a full qualified hostname like desktophostname.mycompany.local or just the desktophostname?

Best,
Manuel

Thank you for your reply,
I think it pointed in the right direction:
Both devices are in the company network. The Network has a Domain Controller / DNS Server / DHCP Server, all devices get the DNS from DHCP
FQDN on the mobile device does not change anything, result is the same as only hostname → communication error.
FQDN instead of hostname on the Desktop creates an ENOTFOUND error.
ping and nslookup of FQDN does not work either from everdo server or other machines.

The Desktop running Linux Mint is not part of the domain, so this might be the reason why.
So I have to check DNS configuration to make FQDN work.

But why doesn’t just the hostname work ? Name is resolved to correct IP on other machines in the network…

I might be misunderstanding something, but I think it’s a DNS configuration issue if nslookup does not resolve the correct server IP address. This would explain why specifying an IP address in sync configuration works, while specifying a domain name does not.

Yes, That the FQDN does not point to the right IP in DNS is a DNS configuration issue.
The hostname itself without domain is resolved correctly into the correct IP on the linux machines.
But maybe not on the android phone, as it this also not working on the windows machines in the network.
You are right, I have to have a closer look at the DNS config
Thank you!