title: c#/.Net Socket.Shutdown
body: <p>I recognize this type of question has a long history, but the way I am using this must be the correct '.net way' and yet it does not seem to work.</p>
  
  <p>I have a trivial synchronous IP server daemon that does a simple AcceptSocket, do some stuff, socket.send, socket.shutdown, socket.close.   My client is another trivial C# app that does URLDownloadToFile.</p>
  
  <p>What happens is that part of the time URLDownloadToFilefails fails with (0x800C0008) .. thinks its download resource failed.</p>
  
  <p>My server side end sequence is:</p>
  
  <pre><code>socket.Shutdown(Both);
  socket.Close();
  </code></pre>
  
  <p>If I change this to </p>
  
  <pre><code>socket.Disconnect();
  socket.Close();
  </code></pre>
  
  <p>(I open the above with sockopt Linger true, timeout 5 secs)</p>
  
  <p>this works great.</p>
  
  <p>Am I missing something on the Shutdown method.. it sounds like the 'magic bullet' MS wants you to use for gracefully doing an exit that will ultimately send any remaining send data.</p>
  
  <p>Grossly, (and this cannot be right) it appears like the close.. kills any async processing that might be in progress from shutdown().</p>
  
  <p>Any ideas?</p>