Heart Beat
-
Hi thre, Could anybody tell me what/how is the best way to generate a HeartBeat for a C++ application to check the integrity of the socket connection to another server/client machine? Thanks for the help
-
Hi thre, Could anybody tell me what/how is the best way to generate a HeartBeat for a C++ application to check the integrity of the socket connection to another server/client machine? Thanks for the help
Unfortunately there is none built-in (at least
SO_KEEPALIVE
won't give you a very useable solution), you probably want to implement an application specific keep-alive mechanism (e.g. for a faster detection time of dead connections). I can recommend reading the book "Effective TCP/IP Programming" from Jon Snader which discusses this topic among others. A book worth to have on a desk or book shelf not far away from you. :) Anyway, I did't want to end the discussion here. One solution that I use in my own software: a timer that triggers sending short amount of data to the clients, in case the connection is down I will receive an error in myOnClose()
handler. The timer intervall depends on your requirements, currently I use 120 seconds which gives my application reasonably quick notification. [answered twice] -
Hi thre, Could anybody tell me what/how is the best way to generate a HeartBeat for a C++ application to check the integrity of the socket connection to another server/client machine? Thanks for the help