gpt4 book ai didi

http - 如何在BlackBerry 5.0 及以上版本的J2ME 代码中使用wifi 调用web 服务?

转载 作者:可可西里 更新时间:2023-11-01 17:10:38 24 4
gpt4 key购买 nike

<分区>

我正在使用 J2ME 代码从 BlackBerry 调用 Web 服务。当我尝试使用 HttpConnection 打开连接时,它只检查 GPRS 连接。现在,我想检查 Wi-Fi 连接并通过 Wi-Fi 调用网络服务。

下面的代码是我的连接部分。如何更改 Wi-Fi 连接的密码?

public boolean HttpUrl() 
{
HttpConnection conn = null;
OutputStream out = null;
String url = "http://www.google.com";
try
{
conn = (HttpConnection) new ConnectionFactory().getConnection(url).getConnection();
if (conn != null)
{

conn.setRequestMethod(HttpConnection.POST);
conn.setRequestProperty("Content-Length", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");


}
}
catch (Exception e)
{
return false;
}
finally
{
try
{
out.close();
}
catch (Exception e2)
{
}
}

//Only if exception occurs, we close the connection.
//Otherwise the caller should close the connection himself.
try
{
conn.close();
}
catch (Exception e1)
{
}
return true;
}

如何实现?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com