Tech Off Post

Single Post Permalink

View Thread: TcpClient - Test for Disconnected?
  • User profile image
    spivonious

    phreaks said:
    cheong said:
    *snip*
    That's all good, but the issue how can you test connectivity when you only have control of one end?

    Say, I am just opening a socket, and reading whatever gets pushed, indefinitely.

    How can I figure out if something hiccups?

    I could have a timer, that checks a timestamp of the last read, and if it's greater than some interval, assume the connection died and recycle the socket; but it seems kludgy.

    I'm also curious if there's a better way to do this than a timeout.