Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2005

    InputStreamReader hangs on S60...

    The inputStreamReader as generated by the HttpConnection() hangs on a read() if there's not enough data to fill the specified buffer. Not good.

    A number of others have noticed the same thing. It apparently works on other systems but not the S60. The solution that was quoted was to use the HttpConnection.getLength() method to read exactly the data needed and no more. Okay, could work..except the damned getLength() returns a -1.

    So, I can't know how much data to read, and the app hangs until infinity+1 if I try to read all of the data with no way to escape. And there seems to be no timeout specifier on any of these calls.

    Is there any solution to this, or is our Nokia 60 project dead.

  2. #2
    Registered User
    Join Date
    Oct 2004

    Re: InputStreamReader hangs on S60...

    I suggest that once you have read the header, you precede your data with two bytes (for example) to indicate the length of the following data block. If you do this you can read the size in the first two bytes (read(buffer, 0, 2)) and then read the number of bytes specified by this size (read(buffer, 0, bytesExpected)).

    This is the algorithm we use and it works fine over sockets, udp and http.

    Alternatively you can conform strictly to http and send your data chunked - read the chunk size and then read precisely the number of bytes defined in the chunk.

Similar Threads

  1. Sending files using BT to specific folder (S60 to S40, S60)
    By WinHw in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2009-03-19, 17:15
  2. Replies: 1
    Last Post: 2005-07-05, 04:23
  3. inputStreamReader hangs on some nokia
    By fkadm01 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-04-11, 09:03
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  5. Almost all tools (S60 MIDP SDK B0.1, Nokia S60 SDK Symbian OS v0.3) Crashes
    By alexandershalamov in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-07-03, 13:44

Posting Permissions

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