Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Heart Beat

Heart Beat

Scheduled Pinned Locked Moved C / C++ / MFC
c++sysadminhelpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nahitan
    wrote on last edited by
    #1

    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

    P M C 3 Replies Last reply
    0
    • N nahitan

      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

      P Offline
      P Offline
      pbraun
      wrote on last edited by
      #2

      Check out the socket option "SO_KEEPALIVE" in your help. Phil

      1 Reply Last reply
      0
      • N nahitan

        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

        M Offline
        M Offline
        Moak
        wrote on last edited by
        #3

        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 my OnClose() handler. The timer intervall depends on your requirements, currently I use 120 seconds which gives my application reasonably quick notification. [answered twice]

        My Webchat

        1 Reply Last reply
        0
        • N nahitan

          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

          C Offline
          C Offline
          cmk
          wrote on last edited by
          #4

          See: http://www.tangentsoft.net/wskfaq/newbie.html#normalclose[^]

          ...cmk Save the whales - collect the whole set

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups