Android 应用程序无法连接到 LAN 服务器

标签 android linux

我正在构建通过套接字连接到 tcp 服务器的 android 应用程序。 当我在 Windows 上运行服务器(java 服务器)时,应用程序连接、发送、接收等都很好,但是当我在 linux(OpenSuse 13.2 kde 桌面)上运行服务器(相同代码)时,该应用程序只能在模拟器上连接。如果我在我的 LG Magna 上运行它,它不会连接。我正在使用我能找到的所有互联网许可。

最佳答案

您必须检查是否可以 ping 通这两个设备。您必须从 android 获取 ip,并从您的服务器尝试从另一个 ping 一个。对于 android,您可以连接 throw adb。但是,如果您从 Linux ping Android 就可以了。我很确定你做不到。

关于Android 应用程序无法连接到 LAN 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34612688/

相关文章:

java - 重复报警不准确

python - 当代码在 Linux 上运行良好时 Windows 上的编码错误

linux - GNU 为 : changing output file format

android - setImeOptions : why the "Done" button does not show on the soft keyboard?

android - Google Assistant SDK 将其集成到应用程序中

Android SharedPreferences 备份不工作

linux - Uinput - 鼠标事件不工作

linux - 如何创建没有不必要空格的 CSV 文件

linux - 从文件中删除控制字符

android - 使用 monkeyrunner 进行自动化测试并检查结果