简体   繁体   English

本地Http请求Android

[英]Local Http request Android

I'm developping an app and I need to store the result of the game in my database. 我正在开发一个应用程序,我需要将游戏结果存储在我的数据库中。 I'm gonna do a local server for that. 我要为此做一个本地服务器。 I already saw how to send a request with android. 我已经看到了如何使用android发送请求。 I just want to know how to do it locally. 我只想知道如何在本地做。 I dont know anything in network so I would like to know if it's different from doing to a non-local server. 我对网络一无所知,所以我想知道它与对非本地服务器的区别。 I want to know if doing localhost:8080/mypage?params is gonna be all right or if I need to be on the same wifi spot to do it, or if I need to do something specific. 我想知道是否可以执行localhost:8080 / mypage?params没问题,或者是否需要在同一个wifi站点上进行,或者是否需要做一些特定的事情。

Thanks 谢谢

As comment said, 正如评论所说,

Doing localhost on any device will go to itself 在任何设备上执行localhost将自行完成

You need to use the server real IP. 您需要使用服务器的真实IP。 Probably, you have dynamic IP, that means your IP is going to change every time you reset your router, so you need to use a Dynamic DNS service, for example: http://www.dnsexit.com/ 您可能拥有动态IP,这意味着每次重置路由器时IP都会更改,因此您需要使用动态DNS服务,例如: http : //www.dnsexit.com/

Moreover, you're going to need to open corresponding port in your router if the app is going to run out of your LAN. 此外,如果应用程序将要用完局域网,您将需要在路由器中打开相应的端口。

As comment said: 正如评论所说:

that is networking 101 就是网络101

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

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