简体   繁体   English

我的本地服务器(沼泽)的android服务器地址会更改吗?

[英]Will the android server address for my local server(wamp) change?

I have set up a wamp server, but i have changed the port to 82 since 80 was already used by something else. 我已经设置了一个wamp服务器,但是由于80已经被其他人使用,所以我将端口更改为82。 Now i have an android app which takes the server address as 10.0.2.2. 现在我有一个Android应用,它将服务器地址设为10.0.2.2。 I have put the address as this. 我把地址写成这样。 But this doesn't work. 但这是行不通的。 Will the server address have to be changed due to changed port number. 由于端口号更改,是否必须更改服务器地址。 If yes, then what will be the correct address through which I can access my php files. 如果是,那么什么是我可以访问我的php文件的正确地址。

You need to specify the port in adress 您需要在地址中指定端口

URL url = new URL("10.0.2.2:82");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(url.openStream()));

You should have read about the networks before you start programming... 在开始编程之前,您应该已经阅读了有关网络的信息。

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

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