×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    15

    IOException when connecting to the server many times

    Every time my midlet connects to the server, a new background thread will be started, and destroyed after data received from the server.

    My midlet works well when connecting to the server, and will always succeed in getting whatever data I want if I process "action after action"(without any interrupt), but if I interrupt for a while(do nothing) between two actions, IOException will be thrown. The error message is as follows:

    java.io.IOException
    at com.sun.cldc.io.j2me.socket.PrivateOutputStream.write1(+25)
    at com.sun.cldc.io.j2me.socket.PrivateOutputStream.write(+40)
    at java.io.DataOutputStream.write(+10)
    at java.io.OutputStream.write(+8)
    at com.sun.midp.io.j2me.http.Protocol.sendRequestGeneric(+502)
    at com.sun.midp.io.j2me.http.Protocol.sendRequest(+124)
    at com.sun.midp.io.j2me.http.Protocol.flush(+35)
    at com.sun.midp.io.BaseOutputStream.flush(+11)
    at com.sun.cldc.i18n.StreamWriter.flush(+7)
    at java.io.OutputStreamWriter.flush(+11)
    at org.kxml.io.XmlWriter.flush(+11)
    at org.kxml.kdom.Node.write(+9)
    at IRSystem.mobile.midlet.IRSMIDlet$DataRetriever.getResultDoc(+83)
    at IRSystem.mobile.midlet.IRSMIDlet$DataRetriever.searchCard(+27)
    at IRSystem.mobile.midlet.IRSMIDlet$DataRetriever.run(+203)

    What's the reason for this problem? I need your help!

    Thanks!!

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    15
    Does anybody know the reason?

    Thanks!!

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    It's difficult to say without knowing more about how your program works... at the point the exception occurs, it looks like you're trying to write data to the network output stream. The most obvious reason why it might throw an IOException when writing to an output stream would be that the output stream is closed. Is that possible?

    Graham.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×