0
我有以下問題。當我在模擬器中執行它時,這個midlet工作正常,但是當我將它上傳到我的motorola i290(與nextel公司)時,我啓動它,它會凍結。所以永遠不要開始(程序開始做一個php頁面的請求)摩托羅拉J290 HttpConnection i290
這裏是代碼,如果有人知道我的程序爲什麼在Wireless Toolkit模擬器中工作正常,而不是在電話中,請讓我知道。由於
這是我的「連接」的方法
String getGrade(String url) throws IOException {
HttpConnection c = null;
InputStream is = null;
OutputStream os = null;
StringBuffer b = new StringBuffer();
TextBox t = null;
int x = 5, y =7;
try {
c = (HttpConnection)Connector.open(url,Connector.READ,true);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0 Confirguration/CLDC-1.1");
c.setRequestProperty("Content-Language", "en-CA");
os = c.openOutputStream();
is = c.openDataInputStream();
int ch;
while ((ch = is.read()) != -1) {
b.append((char) ch);
System.out.println((char)ch);
}
t = new TextBox("Final Grades", b.toString(), 1024, 0);
} finally {
if(is!= null) {
is.close();
}
if(os != null) {
os.close();
}
if(c != null) {
c.close();
}
}
//display.setCurrent(t);
return b.toString();
}
我不明白你的意思「包」是什麼,但我想你的配置和使用POST而不是GET和我仍然有同樣的問題.. – 2012-03-20 14:29:20
它可以只是一個字符串,只是字符串長度和packet.getSentBytes用字符串替換字節packet.getSentLength() – Baba 2012-03-20 15:19:34
我解決它,是我的互聯網服務提供商的問題因爲他們過濾不在「私人網絡」中的方向。謝謝 – 2012-03-20 16:13:20