简体   繁体   English

Android中使用主机名的本地网络

[英]Local Networking with Hostname in Android

I'm working as Mobile Developer.我是移动开发人员。 I am looking for a way that is works as connection to a backend server with computer name/hostname but It is confused situation.我正在寻找一种可以连接到具有计算机名/主机名的后端服务器的方法,但情况很混乱。 Android does not understand or solve the hostnames. Android 无法理解或解析主机名。 Are there any way to solve this problem ?有没有办法解决这个问题?

eg:例如:

Networking with http://192.168.1.10:9000 works as well.http://192.168.1.10:9000联网也能正常工作。

Networking with http://DESKTOP-599U766:9000 does not work as well.http://DESKTOP-599U766:9000 的网络也不能正常工作。

In theory, any device connected to your local network ought to be resolving hostnames through that network's own DNS.理论上,任何连接到本地网络的设备都应该通过该网络自己的 DNS 解析主机名。 In practice, Android has painted itself into a corner here because it defaults to using a hardcoded external DNS, with only the option of selecting an alternate external DNS with its own hostname (it won't permit you to select your router's IP address).在实践中,Android 在这里陷入了困境,因为它默认使用硬编码的外部 DNS,只有选择具有自己主机名的备用外部 DNS 的选项(它不允许您选择路由器的 IP 地址)。 I believe the intention is to prevent a malicious wifi network from providing a bogus hostname for software updates and the like, but it's still frustrating.我相信其目的是防止恶意 wifi 网络为软件更新等提供虚假主机名,但它仍然令人沮丧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM