   [.net] System.Net.Sockets.Socket and killing Accept on close event.
  I have a multi threaded server program using the Socket object. My issue is with killing the Accept method within my thread. When my application is closed the thread cannot exit until the Accept method stops blocking. I have tried manually Aborting the thread and it still hangs. After doing a search on google I found some similar issues posted online. The sugestion was to just close the server's socket and catch the exception that the Accept method will throw (10004 - WSAEINTR - Interrupted function call. This error indicates that a blocking call was interrupted by a call to WSACancelBlockingCall). Is this in fact the correct method for dealing with this issue, or is there a better way? This seems to work, but produces a slight delay when when the application is closing. Thanks.Bill   
  Have you considered using the asynchronous methods (BeginAccept, EndAccept) instead of the blocking ones?   ;  I agree on DaWanderer's approach. Use the Asynchronous methods(BeginAccept/EndAccept, BeginReceive/EndReceive). These are far more flexible, and don't require you to constantly poll the sockets for data, which is tedious.Also, it uses the .NET event sinks to the max, which is always good in making your code easier to read.Toolmaker   ;  i just mark such threads as IsBackground = true, thus they get killed when the all non-background (the mainthread..) - threads die.but recently, i moved to async networking, and it works quite well, too..   