简体   繁体   中英

getRequestCode on nokia J2ME

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM