CLDC+MIDP+携帯電話用 ..
[2ch|▼Menu]
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