• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wireless connection speed for J2ME app on Palm VIIx device

 
liang gu
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
}
 
Javier Gomez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi liang,
Try to read the data at once:
int len=(int)c.getLength();
byte[] data=new byte[len]
is=c.openInputStream();
is.read(data);
it will work only if your server returns the content-length header.
regards,
JAVI
 
Eugene Teo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am still new to stuffs like wireless, so please bear with me. I am wondering if there are any ways for me to simulate wireless connection on my palm Vx (real) or emulated palm in order to test the application. Really appreciate your reply.

------------------
--
eMail: eugeneteo@eugeneteo.net
www: http://www.eugeneteo.net/
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Palm OS Emulator is your best bet. Download from:
http://www.palmos.com/dev/tech/tools/emulator/
It provides for emulating a internet connection.
Bill
------------------
author of:
 
liang gu
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javi:
Thanks for the suggestion. I did try to read the data at once instead of one character by one character. However, it doesn't work because Palm VIIx device only supports inethttp protocal, but not http protocal. And inethttp can't retrieve the content-length field. Anybody has any other suggestions? Thanks in advance.
Liang

[This message has been edited by liang gu (edited November 26, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic