For several days i have been trying to get my Midlet to timeout on http requests after x number of seconds. I want my midlet to do http posts every minute or so and i don't want http posts overlapping and interfering with each other.
The device i am using is a brand new nokia E60.
After discovering that the java.microedition.io classes have nothing in the way of timeouts i decided to write a Timertask that closes the connection and associated streams.
Also, the connection is opened indicating that timeouts should throw exceptions:
HttpConnection conn = (HttpConnection) Connector.open(url, Connector.READ_WRITE, true);
This seems to work on the sun WTK emulator, but on an E60, the device just keeps on trying to connect. I put the device in a steel container to isolate it from the phone-network, waited for a couple of minutes. When i removed it, it was still waiting to connect and regained the connection again. Then it finished the http post which it started before it went into the steel container.
It's as though the close() method on the connection just waits until the device is connection again.
An alternative might be to set a Java VM wide http timeout like on Siemens models, but the E60 does not seem to have this option.
Any help would be appreciated. Has anybody managed to accomplish this?