Tech Off Post

Single Post Permalink

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

    cheong said:
    evildictaitor said:
    Actually I think your usage of "UDP" here is quite misleading as UDP is another thing that is not part of TCP/IP. I know you try to use the analogy that Unix Datagrams don't care whether the receipt receive the packets, but perheps you should just use "packets".

    And yes, the only way to ensure TCP/IP channel is "connected" is to send packet and wait for the "ACK" packet of another side.
    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.