×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    8

    HttpConnection.openInputStream() blocks forever

    I do this in a Nokia 6233 (only in real device, in emulator I have not problem):

    HttpConnection conn = (HttpConnection)Connector.open(url);
    InputStream is = conn.openInputStream();

    I want to get the data from HttpConnection while the data is being downloaded, a streaming of images using mjpeg. But openInputStream blocks forever. I make other connections the same way without problem, but these connections are not "permanent", and are closed quickly.

    Could anybody help me, please

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: HttpConnection.openInputStream() blocks forever

    hi,

    have you checked what response code goes from server when requesting that kind of content?
    are you sure that openInputStream() is in deadlock not your byte data processing routine?

    regards,
    peter

  3. #3
    Registered User
    Join Date
    Jan 2004
    Location
    The surburbs of Bangkok, Thailand
    Posts
    135

    Re: HttpConnection.openInputStream() blocks forever

    I don't know if this relates or not, but this is what I normally do and worked for me: Try getting the OutputStream and close() it first... this flushes things, then open the inputstream you want.



    c = (HttpConnection)Connector.open(hostURL);

    .
    .
    set request method and properties
    .
    .

    OutputStream os = c.openOutputStream();

    //write anything you need to the OutputStream, if needed

    os.close();
    os = null;

    InputStream is = c.openInputStream();


    Something like that... Please try.
    Liberate yourself from the enslavement of World Monopoly!

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8

    Re: HttpConnection.openInputStream() blocks forever

    peterblazejewicz: I can't check response code, because I don´t get any response at client midlet. The only way to get anything is closing connection at server side. Yes, I'm sure openInputStream() is waiting forever.

    ykasidit: I've tried your solution, but it doesn't work for me. I have the same problem when trying to open outputStream (conn.openInputStream(), applications blocks in this sentence). I've also tried outputstream.flush at, server side, but no success. The only way to release blocking at client is closing output stream at server side.

    Any more help would be appreciated
    Thanks both of you

  5. #5
    Registered User
    Join Date
    Aug 2006
    Posts
    9

    Re: HttpConnection.openInputStream() blocks forever

    You must use HttpConnection.openDataInputStream() instead of openInputStream(). Had exact same problem and this fixed it on nokia series 60 2nd edition devices.

Similar Threads

  1. Socket read on Nokia 6600 blocks forever
    By delipsingh in forum Mobile Java Networking & Messaging & Security
    Replies: 9
    Last Post: 2010-04-13, 15:00
  2. read(), readUTF() and readChar() are blocking forever
    By katakis in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-09-10, 19:44
  3. popup notify blocks my program flow
    By ceehira in forum Symbian
    Replies: 0
    Last Post: 2006-08-31, 14:00
  4. Replies: 1
    Last Post: 2003-09-23, 09:54
  5. CLogViewEvent::SetFilterL() blocks ??
    By dgobin in forum Symbian
    Replies: 1
    Last Post: 2003-05-05, 16:56

Posting Permissions

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