0
votes

I have strange problem with nokia phone. I'm developing J2ME midlet and trying to run it on nokia (n73). This midlet makes httpRequest. First, second and several more reqeust makes good. But after that next request fails with IOException.

There are no such problems in WTK emulator.

try{ hcon = (HttpConnection) Connector.open(url);
     if (hcon.getResponseCode() == HttpConnection.HTTP_OK)
        res = hcon.openInputStream();
} catch (IOException e)
{
    ...

There is stack trace:

- com.symbian.midp.io.protocol.http.HttpConnectionNative.throwIOException(), bci=5 
- com.symbian.midp.io.protocol.http.HttpConnectionNative.waitForTransaction(), bci=33 
- com.symbian.midp.io.protocol.http.HttpConnectionNative.sendRequest(), bci=309 
- com.symbian.midp.io.protocol.http.HttpConnectionNative.ensureResponse(), bci=37 
- com.symbian.midp.io.protocol.http.HttpConnectionNative.openDataInputStream(), bci=29 
- com.symbian.midp.io.protocol.http.HttpConnectionNative.openInputStream(), bci=1 
- ru.megafon.sgc.Main.sendHttpGet(), bci=48 
- ru.megafon.sgc.Main$2.run(), bci=115 
- java.lang.Thread.run(), bci=11
1
what IOException , stacktrace please - jmj
It is like "did you plug it?". But, I need to ask to be sure. Emulator uses underlying internet connection on your development PC, did you enable 3G, or WIFI on test device? - baris.aydinoz
Sure. Connection with internet is ok. 3g enabled on test device. And 7 of 8 reqeust working good, but 8th... - Alexander Mikhaylov

1 Answers

1
votes

You're probably not closing the stream AND the HttpConnection object. You must close both, otherwise you'll have problems like what you're seeing -- you can only have one or two connections open at a time in general on these devices.