Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 22
Registered: ‎03-03-2011
My Device: Not Specified

ConnectionFactory timeout


I have a problem with ConnectionFactory class.


 How can we detect the timeout in ConnectionFactory class.(If response from the server is delay)

    - I already set the time out and timelimit in my application





       - I am also using connFact.setConnectionAttemptListener and InterruptedIOException but its not working for me.


Help me if possible

Thank you




BlackBerry Development Advisor
Posts: 15,852
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: ConnectionFactory timeout

An IOException should be thrown if the connection times out.  You can catch that to make your application aware of that event.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Posts: 22
Registered: ‎03-03-2011
My Device: Not Specified

Re: ConnectionFactory timeout

Hi Mark

Thank you for your reply


I already did that but my application was frozen, after frustrating I decided to devolve own timer using Timer class. It’s working for me nicely but I need to do some test on it.

Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

Re: ConnectionFactory timeout

apologies for bumping an old thread but i would like to know the following..


connFact.setConnectionTimeout(10000); Is this a timeout after the connection is opened ? so say,the time out is a  minute, will the connection timeout after a minute even though it is open,and downloading data?



Posts: 434
Registered: ‎07-23-2012
My Device: Blackberry 10
My Carrier: Orange

Re: ConnectionFactory timeout

 I never saw connection time out to work. Even we have tried deviceside=true;ConnectionTimeout=30000;



But it never works. Use the thread and timetask. Get the time between request and response and make the decision

Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: ConnectionFactory timeout

I don't use ConnectionFactory, having effectively written an equivalent sometime ago, so I code the suffix myself.  I can confirm that in all my testing over multiple OS levels ConnectionTimeout works correctly where it is supported, that is for MDS and BIS-B connections.  It is not supported for carrier TCP and WAP, and I don't believe it is supported for WiFi. 


So no, it won't work for


as it is not supported for carrier TCP connections.  But it does work using



Since OS 4.5, you have been able to use SocketConnectionEnhanced to set a Timeout and this is supported for Direct TCP.  I believe that another contributer here, simon_hain, has used this and that it does work (search the forum), though i think there was an issue with OS 4.5.  I have never used this.  I use a Timer and TimerTask to time out connections that are not going through BES or BIS-B. 


Sorry I can't comment on the way ConnectionFactory has been implemented.  I would have hoped it did something similar to what I do, i.e. use the built-in facilities where these are available and a Timer where they are not.  But perhaps it does something different.