简体   繁体   English

如何通过移动互联网连接本地 java 服务器和 android 应用程序?

[英]How connect local java server and android app by MOBILE internet?

I have Java server on my local machine and android app witch connect to this server.我的本地机器上有 Java 服务器,而 android 应用程序连接到该服务器。 I need connect to server use mobile internet.我需要使用移动互联网连接到服务器。 I can connect with WIFI.我可以连接WIFI。 But my task need mobile internet.但我的任务需要移动互联网。 I see 1 solution: 1. Deploy server to remote host(but i can't debbug I'll have to use logs and constantly deploy the server) But i don't want so many.我看到 1 个解决方案: 1. 将服务器部署到远程主机(但我无法调试,我必须使用日志并不断部署服务器)但我不想要这么多。 Maybe do somebody know how fix this problem easier?也许有人知道如何更轻松地解决这个问题?

This is a networking problem.这是一个网络问题。 For your local instance you need to setup a static IP address so that your mobile device can connect to it.对于您的本地实例,您需要设置一个静态 IP 地址,以便您的移动设备可以连接到它。

By default, your machine is likely firewalled from the Internet.默认情况下,您的计算机可能已通过 Internet 防火墙设置。 Once you have a public IP you can connect to your local machine on that port.拥有公共 IP 后,您可以通过该端口连接到本地计算机。

There are probably a whole bunch of details about setting up your network to be visible - it really depends on how you are accessing the Internet now.可能有一大堆关于将您的网络设置为可见的详细信息 - 这实际上取决于您现在访问 Internet 的方式。

If you give more details about your network setup, it would be easier to answer your question.如果您提供有关网络设置的更多详细信息,那么回答您的问题会更容易。

Btw, be careful exposing your local machine - plenty of hacking going on out there.顺便说一句,小心暴露你的本地机器 - 那里有很多黑客攻击。

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

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