×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    22

    Timeout on Connector.open() ??

    Hello.

    Does anyone of you know, how to set a timeout on the Connection.open() method? I know the 3rd parameter is "boolean timeout" which doesn't have any affect. If i call this method passing an faulty URL it blocks forever. I managed it with different threads, but this leads to other problems..

    Thanks for your answers.

    Greet

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Timeout on Connector.open() ??

    did you find any answer?

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Timeout on Connector.open() ??

    Hi,
    I can give you an idea..
    As soon as you are just going tom open the connection then you start a timer..and keep on counting.When you think that at this time it should be time out connection..then make the connection as close and show the same to the user..

    One more think if I am not wrong then 19 seconds is the standard time to check for the time out.

    And I hope you have open the connection on a thread..
    Thanks
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timeout on Connector.open() ??

    out of experience the standard timeout is more like 60 secs on nokia's...
    but no there is no way to set it "automagically"...
    one of the methods I know of is the one raj_j2me mentions...

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Timeout on Connector.open() ??

    Hi,
    Another way to doing the same can be ..you can check the timeout from server side and send to the client.Thats easy and very fixable way ..I am using this one..
    Tell your server side team that please make the Request Timed Out and they will check this and send you a response and you just draw on the screen...
    Another way for the same will be unappreciated..
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  6. #6
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    65

    Re: Timeout on Connector.open() ??

    Quote Originally Posted by raj_J2ME View Post
    Hi,
    I can give you an idea..
    As soon as you are just going tom open the connection then you start a timer..and keep on counting.When you think that at this time it should be time out connection..then make the connection as close and show the same to the user..

    One more think if I am not wrong then 19 seconds is the standard time to check for the time out.

    And I hope you have open the connection on a thread..
    Thanks
    One the best possible methods for checking timeout is to have 2 threads -1 thread for the connector.open and the other to check for timeout. when the predefined timeout occurs the 2nd thread will call for the close of the connector and the thread and throw an alert to the user saying connection timeout.

    Most of the Time the Connector throws an IOException error when there is a time out.
    You can check this discussion for more details

    http://forums.sun.com/thread.jspa?th...157683&start=0
    Thanks and Regrads
    Pradeepcg

  7. #7
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timeout on Connector.open() ??

    please take into account that the second method given by raj_j2me will only work if u have a valid and working connection (internet-connection), which most of the time is the problem with a time-out...
    personally I wouldnt use that method, simply because if u lose internet connection and u want to tell ur user (most of the time a time-out is used for that) u wont notice anything because u wont get an error-timeout from ur server, because of the lacking connection...
    so it's not a really feasible option, its wha they call a vicious circle...
    ur app loses internet connection, waits for timeout to be told so, server cant deliver timeout because of lost internet connection, app still wiats for timeout and just assumes everything is right...
    Last edited by Tiger79; 2008-11-11 at 09:28.

Similar Threads

  1. Why operation timeout is to be handled manually?
    By vaibhavjain in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-07-30, 12:36
  2. 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
  3. Http timeout
    By earamsey in forum Mobile Java General
    Replies: 0
    Last Post: 2007-09-10, 18:12
  4. timeout value in Connector.open()
    By scheung3 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-10-18, 16:21
  5. NO TimeOut @ PrepareRequest / IPCSyncRequest
    By adestis in forum Multimodecards
    Replies: 3
    Last Post: 2003-03-27, 07:54

Posting Permissions

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