views:

26

answers:

0

Here is the exception that I have : System.Net.Sockets.SocketException:A connection attempt failed because the connected party did not property respond after a period of tiime, or established connection failed becasue connected host has failed to respond

at System.Net.Socket.Receive(Byte[] buffer, INt32 offset, int32 size, SocketFlags socketsFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, int32 size)

My download application code very easy I am just using code like this. I have never got that exception before. By looking at the exception of thrown from the server, looks like the Ftp server did not respond. So I am posting this issue here, hopefully somebody had encountere this kind of exception before. Your ideas and suggestions are highly appreciated . Thank you

Here is the code sample:

FtpWebRequest request = (FtpWebRequest)WebRequest.Create(currentFilePath);
            request.Method = WebRequestMethods.Ftp.DownloadFile;
            request.KeepAlive = true;
            request.Credentials = new NetworkCredential(FtpUserName, FtpPassword);