It worked, however, the connection speed is painfully slow. It takes about 1 min. to send and receive 300 charactors on the Palm VIIx device. As for comparisons, it only takes few seconds on the simulator(connected through LAN/WAN) for the same application. And for other defaultly installed non-J2ME wireless applications on the Palm VIIx device, e.x., ABC News, Amazon, etc., it also only takes few seconds to retrieve 500~600 characters.
Does anybody know why the J2ME wireless communication on Palm VIIx device is so slow? Any solutions?
My code is like in the following:
private String getWirelessQueryResult(String urlStr) {
StringBuffer sb = new StringBuffer();
InputStream is = null;
StreamConnection c = null;
try {
c = (StreamConnection)connector.open
(urlStr,Connector.READ_WRITE);
is = c.openInputStream();
int ch;
while((ch = is.read()) != -1) {
sb.append((char)ch);
}
} catch (IOException e) { sb = new StringBuffer("error"); }
finally {
try
{
if(is != null) { is.close(); }
if(c != null) { c.close();}
}
catch (IOException e) {}
}
return sb.toString();
}
I have also tried to read the data at once instead of one character by one character. However, it doesn't work because inethttp protocal can't retrieve content-length.
Originally posted by liang gu:
It worked! Thanks, Bill.
Liang