I'm maintaining a J2ME application where I found a http request to http://www.google.com in application initialization. I asked the developer why there is a request to google. He said that this way the other requests that the application makes would be faster.
I removed this request to google.com and the other requests got slower.
Can anyone explain why this happened? How can I make the other request faster without making previous requests?
EDIT:
Making request to google in initialization:
Without making request in initialization:
On a mobile device initiating the web connection will take sometime and quite often the JVM will leave the connection open for the duration of the MIDlet running (most modern connections are charged per byte - Edge, GPRS, WiFi). So if a connection is made on startApp, you might find the connection will stay open and all further communication will not need to open a connection, only send data. So fast and more reliable!
This behaviour is platform specific, MIDP2 does not stipulate this to be true (so Nokias may differ to Samsungs etc).
Connecting to 127.0.0.1 will probably not fool the JVM, which may decide it doesn't need an open GPRS connection for that. Again platform specific.
James
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With