作者CPR520 (时间是魔法!?)
看板AndroidDev
标题[问题] 关於http file sever登入问题
时间Sat Jan 28 23:17:53 2012
前辈们好
请教http file sever(HFS)登入程式
自己在local端建一个HTTP file server
我要做的事,是把帐号、密码给输入手机介面里面,
按下OK後,送出帐号密码给server端。
想去下载里面资料,想请教试了很久怎麽都登不进去
server端也看不到有人登入的资讯,所以想说应该是没登入成功
以下是我的部分程式码想请问哪边有问题 或者有可以参考的相关资料 谢谢大家
String uriAPI = "
http://192.168.1.4/cpr";
HttpPost httpRequest =new HttpPost(uriAPI);
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("使用者名称",un.getText().toString()));
postParameters.add(new BasicNameValuePair("密码", pw.getText().toString()));
try{
HttpRequest.setEntity(newUrlEncodedFormEntity(postParameters,HTTP.UTF_8));
HttpResponse httpResponse=new DefaultHttpClient().execute(httpRequest);
if(httpResponse.getStatusLine().getStatusCode()==200){
String strResult=EntityUtils.toString(httpResponse.getEntity());
un.setText(strResult);
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.67.141.6
※ 编辑: CPR520 来自: 203.67.141.6 (01/28 23:21)
1F:推 Ting1024:192.168 是内网,手机能找到吗? 01/29 02:02
2F:推 blueoick:之前做过阳春的 不过server那边是自己写的 01/29 18:44
3F:→ CPR520:请问有参考资料可以参考吗??谢谢!! 01/29 19:29
4F:→ CPR520:内网这问题没考虑过 ~我有试过登外网 也是没回应!! 01/29 19:30
5F:推 blueoick:因为是自己写的 所以知道使用者名称和密码栏位是什麽 01/30 17:21
6F:→ blueoick:我猜 现成的server应该不会是叫"使用者名称"和"密码" 01/30 17:22
7F:→ higoodman:在模拟器的电脑上装wireshark看到底有没有送封包出去 02/01 21:15