• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is Connectionalive (Urgent)  RSS feed

 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am writing client program with the use of java. I want to know , when server gets disconnected or turn off the machine, how would I know that socket connection is still alive or not?
Is there any API or way to find this one out?
Thanks
Angela
 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Angela Jessi:
Hi,
I am writing client program with the use of java. I want to know , when server gets disconnected or turn off the machine, how would I know that socket connection is still alive or not?
Is there any API or way to find this one out?
Thanks
Angela


Hi!..
i don't know is there any API provided by JAVA or not...
but..
i use this kind of method...
i tried to send something, i mean, anythings to the server using the same socket connection.
if the server reply, i will consider the connection is alive...
if not, i will consider, the connection is terminated..
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ariffin Ahmad,
 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If you have control over client side then create heart beat.
The server will cache the beats and if you do not receive next beat within timeout, then consider the server to be disconnected.
Yarik.
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is heat beat?
Thanks
angela
Originally posted by Yaroslav Chinskiy:
Hi,
If you have control over client side then create heart beat.
The server will cache the beats and if you do not receive next beat within timeout, then consider the server to be disconnected.
Yarik.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!