Welcome!

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

Reply
Regular Contributor
Posts: 57
Registered: ‎09-22-2010
My Device: Not Specified
Accepted Solution

Connectivity issue

Hi all,

 

I have a pretty weird issue:

My application successfully connects to a service, where it sends and receives some Json content. Writing and reading are succesfuly working in 2 independent threads that share the same connection. The amount of data received is in medium around 1kb / second. Data sent 20 bytes / 10 seconds - this acts as a keep-alive mechanism.

 

What happens is that connection drops after 1 minute or so giving me either "java.io.InterruptedIOException: Local connection timed out after ~ 120000", or "net.rim.device.api.io.ConnectionClosedException" ... But, this happens only for BES/MDS, BIS and Wap2.0. Via Direct TCP or Wi-Fi everything is fine ...

 

I am far from being an MDS expert, but is there some extra handling for these 3 connection modes?

 

 

Regards,

gunar

Developer
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Connectivity issue

You can change the ConnectionTimeout to something higher (don't know if there is a limit) by adding it to the url + ";ConnectionTimeout=999999999"

Regular Contributor
Posts: 57
Registered: ‎09-22-2010
My Device: Not Specified

Re: Connectivity issue

This "ConectionTimeout" can be added to MDS, BIS and Wap2.0 connections?

Regular Contributor
Posts: 57
Registered: ‎09-22-2010
My Device: Not Specified

Re: Connectivity issue

That didn't work ... To give further description for this: When I receive data from server I don't get these exceptions ... If server stops sending them (I send an application protocol specific message), then after 1 minute or so - in this time, once per 10 seconds I am sending these keep-alive messages, let's call them heartbeats - connection drops. But only for BES, BIS and Wap. Everything is fine on Direct TCP and Wi-Fi.

 

Doing this test from an MDS simulator, shows that connection is dropped by MDS simulator, as I am getting IOException on DataInputStream.read() method.

 

I tried to add socket.setSocketOption(SocketConnection.KEEPALIVE, 1); but that didn't help.

 

 

Do you have any clue what might be the reason for all these?

Regular Contributor
Posts: 57
Registered: ‎09-22-2010
My Device: Not Specified

Re: Connectivity issue

Getting back long after the issue was fixed: it turns out the phisical connection was not closed ... I am just catching this exception and don't do anything else. Reading will not be affected in subsequent data deliveries.