Wireless connection speed for J2ME app on Palm VIIx device
liang gu
Ranch Hand
Joined: Nov 05, 2001
Posts: 89
posted
0
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();}
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
Joined: Nov 19, 2001
Posts: 3
posted
0
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.
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
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:
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).]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Wireless connection speed for J2ME app on Palm VIIx device