08-08-2011 05:08 PM
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
08-11-2011 09:15 AM
An IOException should be thrown if the connection times out. You can catch that to make your application aware of that event.
08-11-2011 09:58 AM
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.
08-10-2012 06:53 AM
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?
08-10-2012 10:45 AM
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
08-10-2012 12:55 PM
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.