C # /. NET Socket.Shutdown

I understand that this type of question has a long history, but the way I use it must be the correct ".net way", and yet it does not work.

I have a trivial synchronous IP server daemon that does a simple AcceptSocket, does some things, socket.send, socket.shutdown, socket.close. My client is another trivial C # application that makes URLDownloadToFile.

What happens is that part of the URLDownloadToFilefails fails with (0x800C0008) .. believes its download resource failed.

My final server side sequence is:

socket.Shutdown(Both);
socket.Close();

If I changed it to

socket.Disconnect();
socket.Close();

(I open it with sockopt Linger true, timeout 5 secs)

this works great.

- - Shutdown. " " MS , , .

, ( ), , .. , shutdown().

?

+5
2

Socket.Disconnect

Disconnect Shutdown, DontLinger Socket false - , . . DontLinger - false -, Close .

, Shutdown ...

+3

:

socket.Shutdown(SocketShutdown.Both);
socket.Disconnect(true);

:

socket.Shutdown(SocketShutdown.Both);
socket.Close();
+2

All Articles