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#
  4. Detecting when one side of a Socket Connection Closes

Detecting when one side of a Socket Connection Closes

Scheduled Pinned Locked Moved C#
sysadmintutorialquestion
3 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.
  • K Offline
    K Offline
    Kurt _B
    wrote on last edited by
    #1

    I am using the Socket class to communicate between two applications and if I close my server app closing the socket connections my client app is unable to detect that it is closed. Even doing a send from the client app does not throw an exception. Does anyone know how to detect if a socket has been closed from the other side? Thanks Kurt

    N 1 Reply Last reply
    0
    • K Kurt _B

      I am using the Socket class to communicate between two applications and if I close my server app closing the socket connections my client app is unable to detect that it is closed. Even doing a send from the client app does not throw an exception. Does anyone know how to detect if a socket has been closed from the other side? Thanks Kurt

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      What does the Connected property read as when you do this? Is there a timeout issue, i.e. you haven't waited long enough for the timeout to kick in and say the connection has been closed?

      only two letters away from being an asset

      K 1 Reply Last reply
      0
      • N Not Active

        What does the Connected property read as when you do this? Is there a timeout issue, i.e. you haven't waited long enough for the timeout to kick in and say the connection has been closed?

        only two letters away from being an asset

        K Offline
        K Offline
        Kurt _B
        wrote on last edited by
        #3

        Connected property is true. Even tried waiting a few minutes. Using asynchronous methods which do not use a timeout I believe.

        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