×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    16

    Question How to accomplish a timeout on a httpConnection?

    Hello,

    For several days i have been trying to get my Midlet to timeout on http requests after x number of seconds. I want my midlet to do http posts every minute or so and i don't want http posts overlapping and interfering with each other.

    The device i am using is a brand new nokia E60.
    After discovering that the java.microedition.io classes have nothing in the way of timeouts i decided to write a Timertask that closes the connection and associated streams.

    Also, the connection is opened indicating that timeouts should throw exceptions:

    HttpConnection conn = (HttpConnection) Connector.open(url, Connector.READ_WRITE, true);

    This seems to work on the sun WTK emulator, but on an E60, the device just keeps on trying to connect. I put the device in a steel container to isolate it from the phone-network, waited for a couple of minutes. When i removed it, it was still waiting to connect and regained the connection again. Then it finished the http post which it started before it went into the steel container.

    It's as though the close() method on the connection just waits until the device is connection again.

    An alternative might be to set a Java VM wide http timeout like on Siemens models, but the E60 does not seem to have this option.

    Any help would be appreciated. Has anybody managed to accomplish this?

    Regards,
    Robin

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

    Re: How to accomplish a timeout on a httpConnection?

    hi Robin,

    http://discussion.forum.nokia.com/fo...ection+timeout
    are you sure you are not getting any exceptions?
    (make sure midlet is exported for CLCD 1.1/MIPD 2.0 - something I remember from a thread on sun forum),

    regards,
    Peter

Similar Threads

  1. HttpConnection timeout property -- Is it possiblee to set it (or at least read it)?
    By _ericlo_ in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2008-06-11, 11:18
  2. How to get a HttpConnection by a WAP access point over GPRS
    By robinyu2003 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-01-20, 14:34
  3. HttpConnection through a wap gw with Nokia 6600
    By ntalfer in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-01-20, 14:29
  4. jsme symbian error HttpConnection
    By tomereg in forum Symbian
    Replies: 0
    Last Post: 2004-04-05, 10:50
  5. Httpconnection and timeout: Is it possible or not? (NOKIA 6600)
    By saraujo in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2004-01-13, 20:25

Posting Permissions

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