我想用HttpClient调用一个servlet。如果我使用localhost,我的代码工作正常。但我想在URL中使用机器名称,即rach-pc
,我该如何处理?还有其他方法吗?
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://rach-pc:8080/MobileServer/Mservlet");
try {
HttpResponse response = httpclient.execute(httppost);
} catch (Exception e) {
}