I have a file transfer application that moves files between FTP servers. Like every time we can have dozens of files in motion. To prevent floods of FTP servers, I have a monitor and semaphore locking system.
Each time, my FTP client hangs somewhere inside System.Net.Sockets.Socket.Receive () according to the call stack. I do not get an exception, so I can not solve the problem. I would like to cancel the thread as it blocks other threads that the FTP client wants to use.
I considered launching a method that ultimately calls System.Net.Sockets.Socket.Receive () on a new thread and interrupting the thread after a period of time, but I am concerned that sockets will remain open after the thread is interrupted. Is there a more graceful way to kill and cleanse after a non-responsive stream?
source
share