none
Socket.Send method does not throw exception even though connection lost RRS feed

  • Question

  • Hi,

    I created a TCP server with TcpListener and TcpClient classes. In following scenario no exception is thrown.

    1. Client connect to server
    2. I unplug network cable between server and client
    3. Server sends a message to client

    The Socket.Send(buffer) method returns exactly the number of bytes I wanted to send but the client never receives the message because the cable is unplugged. Only after I send the second message I receive a SocketException.

    My problem is that I have to notice that the message could not be send.

    How do I determine if the message was send successfully?

    I tried setting NoDelay=false but without success.

    Wednesday, January 16, 2013 4:10 PM

Answers

  • Hi, It seems this is a known issue. Check a thread:

    http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/7d655146-08d6-43d2-a518-8e49f5c8703e

    Monday, January 21, 2013 9:11 AM