I am using a StreadReader in an ftp put process.
The problem is the .Read() method can stall or hang, and there is no
built in timeout or error thrown.
Is there a way to throw an exception, or do I need to use a different
technique. I've examined at least 4 different implementations of ftp
libraries in c# and they all use the same basic code. I've also tried
using both a StreamReader and a BufferedStreamReader.
Here's where the code hangs (it gets stuck on the .Read in the while loop):
BufferedStream inputb;
while ((bytes = inputb.Read(buffer,0,buffer.Length)) > 0)
{
cSocket.Send(buffer, bytes, 0);
}
The thing is it actually does ftp the file, it's just the code gets
stuck on the final read, and can't continue to the next steps.
At this point, I am thinking of implementing a watchdog thread to throw
an error after a few seconds. I've used that in java successfully for
another project.
--
Get the new
http://www.you-read-it-here-first.com
content from Texeme Textcasting Technology