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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Trusted Contributor
lyon819
Posts: 243
Registered: ‎08-19-2010
My Carrier: TT

Does anyway check socket connection status?

In java EE,

 

socket.isconnected() can be used to check connection status.

 

I could not find a related class in the BlackBerry API.

 

if anyone knows it, please tell me.

 

Thanks your attention,

 

 

-Fight with BB10
Please use plain text.
Contributor
itsandybra
Posts: 28
Registered: ‎09-28-2011
My Carrier: Vodafone

Re: Does anyway check socket connection status?

Hello, I had a similar problem. Eventually my solution (although not elegant) was to create a "heartbeat" thread. The thread loops repeatedly and send an alive check message to the server. When the server receives the message it sends a reply back. If the thread doesn't receive the reply in a certain amount of time (in my case 5 seconds) it can assume that the connection is dead.

Hope it helps :smileyhappy:
Please use plain text.