nanjiniao 发表于 2006-11-6 17:13

[求助] 拜求MOTOV600手机可以访问互联网的程序样例

<P>[em13]</P>
<P>我写了一段程序访问公网,但总是连不上去,请高手前辈给予指点,谢谢!!!!<BR>以下是我的代码:</P>
<P>      HttpConnection  http = (HttpConnection) Connector.open("<a href='http://10.0.0.172/intl/zh-CN/",Connector.READ,true' target="_blank" >http://10.0.0.172/intl/zh-CN/",Connector.READ,true</A>);<BR>      http.setRequestProperty("X-Online-Host", "<a href="http://www.google.com" target="_blank" >www.google.com</A>");<BR>      http.setRequestMethod(HttpConnection.POST);<BR>      http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");<BR>      http.setRequestProperty("Accept", "*/*");<BR>      oStrm = http.openOutputStream();<BR>      inMsg = "game=" + inMsg;<BR>      byte data[] = inMsg.getBytes();<BR>      http.setRequestProperty("Content-Length", "" + data.length);<BR>      OutputStream oStrm.write(data);<BR>      oStrm.flush();<BR>      InputStream iStrm = http.openInputStream();</P>

千里冰封 发表于 2006-11-8 20:55

有什么异常么?

nanjiniao 发表于 2006-11-9 09:34

<P>到oStrm = http.openOutputStream();时就失败了,无法正常打开流<BR></P>

千里冰封 发表于 2006-11-9 10:24

异常信息是什么?

mercyblitz 发表于 2006-11-11 14:58

楼上的正解,没有异常处理啊!!

页: [1]

编程论坛