Connection failed

0 votes
asked Aug 2, 2010 by neham (120 points)
edited Mar 22, 2011

I am trying to upload my text file using putfile function it give error" connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond". In my code there is no problem in connection this error occurs when i using putfile method for upload files.Here i am written my code please see it and suggest what i do.

string str2 = Convert.ToString(ftp.PutFile(@"C:\Documents and Settings\neetesh\Desktop\FTPS Project All\Test\shwetamber.docx", "/wwwroot/shwetamber.docx"));
if (ftp.PutFile(listView1.Items[i].SubItems[1].Text,strSort(listView1.Items[i].SubItems[1].Text)) > 0)
Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Aug 2, 2010 by Martin Vobr (12,820 points)
edited Aug 2, 2010

Hello, this is a network error and usually means that the target machine/port is not accessible. Possible causes:

  1. The target machine is offline or not connected to the network at the moment.
  2. No FTP server runs at the target machine at specified port.
  3. Access to the specified port was blocked by firewall policy at the target machine.
  4. Access to the specified port was blocked by firewall policy at your local machine.

Are you able to connect to the target machine using any third-party FTP client (such as Filezilla) from the same computer where you tried running your code?

This kind of error is usually thrown from ftp.Connect call and not from ftp.PutFile.

Could your either edit your question and include the FTP communication log or mail it to for analysis? You can see how to create a communication log at This log will include the exception details and might help us to determine the root cause of the problem.