Home
2008:
January
February
March
April
May
June
July
August
2007:
January
February
March
April
May
June
July
August
September
October
November
December
2006:
January
February
March
April
May
June
July
August
September
October
November
December
2005:
January
February
March
April
May
June
July
August
September
October
November
December
2004:
January
February
March
April
May
June
July
August
September
October
November
December
2003:
January
February
March
April
May
June
July
August
September
October
November
December
2002:
January
February
March
April
May
June
July
August
September
October
November
December
2001:
January
February
March
April
May
June
July
August
September
October
November
December
2000:
April
May
June
July
August
September
October
November
December

(keitai-l) Re: "i-appli taking long time connecting to servlet"

From: Peter Van der Weeen <pvanderweeen_at_cerego.co.jp>
Date: 06/07/05
Message-ID: <5B7792BCE2065647A133C5800CDF83801ABD52_at_exchange.cerego.co.jp>
>Also at server side do we need to do some kind of caching
>Could anyone tell me why this is taking so much time and also what
>optimized code to write on server side
It depends on what you're trying to do here, but caching is normally not
required.

How long does it take to download a small graphic or static text/html
file to your appli?
If that's fast then you have indeed a problem on the server side. If
that also takes 20 secs, then I'd spend some time looking at the appli
source instead.


If you're using DoJa then I guess your code looks similar to the source
below, is that correct?
static byte[] immediateGet(String p_location) throws Exception {
byte[] x_data = null;
InputStream i = null;
HttpConnection c = null;

try {
	c = (HttpConnection) Connector.open(m_url + p_location,
Connector.READ, true);
	c.setRequestMethod(HttpConnection.GET);
	c.connect();
	i = c.openInputStream();
	x_data = handleResponse(c, i);
}
catch (Exception e) {
	throw new Exception("Exception occurred");
}
finally {
	if (i != null) {
		try {
			i.close();
		}
		catch (Exception e) {
		}
	}
	if (c != null) {
		try {
			c.close();
		}
		catch (Exception e) {
		}
	}
}
return x_data;
}

With the above routine, it takes typically 3-6 seconds to set up an
connection from your phone. From the emulator it's almost instant so we
concluded that this delay is caused by going through Docomo's systems
rather than the webserver. you're talking to. After the initial
connection has been established, uploads and downloads are pretty fast.

Anyway, you should be able to find more information on this on the web
and in (Japanese) DoJa programming book.


Peter 
Received on Tue Jun 7 16:12:32 2005