Hi, I come across a problem related to flush() in j2me environment. Thank you for taking some time to read.
A server writes data to a midlet through HttpConnection established by the midlet. The expected behavior is like this
Server side:
server writes some data
server flush
server wait
server writes some data
server flush
server wait
server writes some data
server flush
Midlet side:
receive some data
processing
wait
receive some data
processing
wait
receive some data
processing
wait
This behavior works in J2SE perfectly. Some Sun emulators also supports all these well. But in Nokia emulators, and most importantly, real handset (e.g Nokia 7610, Moto v303), it is not working as expected at all.
They do something like this:
Server writes data and flushes, midlet waits on getResponseCode()
Server writes more data and flushes, midlet still waits there
Server writes more data and flushes, midlet still waits at getResponseCode(), like it hangs.
Server closes, midlet finally moves, and receives everything in one go.
All makes flush() method seem not to support j2me httpconnection.
I was firstly thinking that's because of nokia implementation. But the fact that it does not work on real handsets (nokia and moto) inspires me that it's not simply due to nokia implementation.
if nokia, moto and others all implements j2me http networks in such a way, we have to say "that's for j2me".
The real confusing behavior of Sun WTK emulator gives me a little hope by showing everything received well from server sides' flushes. I'd try my best to find out if there possibly exists methods that could tune either server sides or midlet somehow to correct and realize this process.
Thanks in advance.

Reply With Quote

