Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User katakis's Avatar
    Join Date
    Sep 2006
    Posts
    1
    Hi

    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

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

  2. #2
    Super Contributor shmoove's Avatar
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    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?

    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved