我已经设置了一个wamp服务器,但是我已经将端口更改为82,因为80已经被其他东西使用了。现在我有一个Android应用程序,其服务器地址为10.0.2.2。我把地址作为这个。但这不起作用。是否由于端口号更改而必须更改服务器地址。如果是,那么我可以访问我的php文件的正确地址是什么。
答案 0 :(得分:1)
您需要在地址中指定端口
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()));
在开始编程之前,你应该已经阅读过网络了......