CLDC+MIDP+携帯電話用 ..
338:デフォルトの名無しさん
06/12/05 02:24:28
3G端末でPOST通信がしたくて下記のようにしているのですが、
通信確認の画面ではいを選択しても一向に通信が始まりません。
何がおかしいのでしょうか?
jadにMIDlet-Permissions: javax.microedition.io.Connector.http
は追加してあります。
String POST(String URL,String str) {
try {
HttpConnection connection = (HttpConnection)Connector.open(URL, Connector.READ_WRITE, true);
connection.setRequestMethod(HttpConnection.POST);
connection.setRequestProperty("content-type", "application/x-www-form-urlencoded");
OutputStream os = connection.openOutputStream();
os.write(str.getBytes());
os.close();
InputStream is = connection.openInputStream();
int length = (int)connection.getLength();
byte[] data = new byte[length];
is.read(data);
is.close();
connection.close();
return new String(data);
} catch (Exception e) {
return "エラー";
}
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
3997日前に更新/119 KB
担当:undef