Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2006

    read(), readUTF() and readChar() are blocking forever


    I'm trying to do a simple MIDlet that connects to a server via a SocketConnection and reads some Strings from the corresponding DataInputStream. The program works fine when using the wtk emulator but on my n6600 the programm blocks forever as soon as it tries to read from the DataInputStream. I've tried read(), readChar(), readByte() and readUTF()... all are blocking
    Is this some bug/problem with the n6600 or am i doing something wrong?

    Here is some sample Code

    SocketConnection loginConn = (SocketConnection) Connector.open("socket://" + url + ":" + core.getServerPort());
    DataOutputStream loginOs = loginConn.openDataOutputStream();
    DataInputStream loginIs = loginConn.openDataInputStream();
    statusMsg = "Trying to log in...";
    String response = loginIs.readUTF();
    //any code beyond this line wont be reached at all

  2. #2
    Super Contributor
    Join Date
    Mar 2003

    Re: read(), readUTF() and readChar() are blocking forever

    If no data is coming in then those methods are supposed to block (at least until a timeout happens and an Exception is thrown). Are you sure the connection is successful? Do you see the "001" arriving on your server? Are you sure the server is sending data?


Posting Permissions

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