Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User weedy's Avatar
    Join Date
    May 2003
    Posts
    14
    I'm writing a MIDlet which uses a HttpConnector wrapped up in a thread. I run it threaded so that if a connection is taking too long, the end user can click a cancel button to stop the request.

    I'm having a HUGE problem with this. It seems that when a request is made via HttpConnector, it absolutely MUST be allowed to complete on a phone. To attempt to stop the connection I use the HttpConnector.Close() method, and then set the HttpConnector object and its container thread to null, but to no avail. If I try and make any other connection after doing this on the phone it fails, throwing an IOException (with no getMessage() text).

    Has anyone seen this? Basically the problem is how to stop/close/cancel/terminate a HttpConnector request properly, so the phone's connection resources are fully freed up. At the moment whenever I make a request it has to be allowed complete or the phone no longer allows any other request.

  2. #2
    Regular Contributor TomXX's Avatar
    Join Date
    Apr 2003
    Location
    Slovakia/Bratislava
    Posts
    67
    Simple ignore that exception...it should work...

    public void cancel()
    {
    try
    {
    //m_bCancel=true
    if(m_oHttpConnection!=null) m_oHttpConnection.close();
    }
    catch(Exception oFooEx)
    {
    }
    }

    Tom

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