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. How to detect a winsock connection lost

How to detect a winsock connection lost

Scheduled Pinned Locked Moved C / C++ / MFC
c++sysadminjsonhelptutorial
2 Posts 2 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.
  • S Offline
    S Offline
    sirtimid
    wrote on last edited by
    #1

    I'm using the winsock API in my VC++ 2008 app. When the application is running and the socket is connected all the time reading/writing, I unplug the network cable to force a network problem. In order to check if the connection is down I just send 0 bytes to the socket, but I still returns 0 instead of SOCKET_ERROR. Does anyone know how to check if the connection is down?

    L 1 Reply Last reply
    0
    • S sirtimid

      I'm using the winsock API in my VC++ 2008 app. When the application is running and the socket is connected all the time reading/writing, I unplug the network cable to force a network problem. In order to check if the connection is down I just send 0 bytes to the socket, but I still returns 0 instead of SOCKET_ERROR. Does anyone know how to check if the connection is down?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please do not crosspost; this has already been answered here[^].

      Unrequited desire is character building. OriginalGriff

      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