I have just developed a J2ME app on Palm VIIx device. Everything works exactly as what I have designed, except that the wireless communication to send and receive infomation 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();
}