File Transfer with diffrent port is not working .

0 votes
asked Sep 21, 2010 by Shwetamber (290 points)
edited Mar 30, 2011

Hi,

I am trying to upload files over secure FTP. When i use Default port(22) for SFTP, Then it connecting to server and file transfer begins but if i use another port (Such as 990), then it does not connect to the server. Whereas i can connect with same port from another ftp client software.

Can any one suggest me how i can connect to server with different port. and why it is not connecting this time. I am writing my code below

ftp.Connect("My Domain Name", 990, tlsParameters, FtpSecurity.Implicit);

Please help me about this problem

Thanks & regards
Shwetamber Chourey
India

Applies to: Rebex FTP/SSL, Rebex SFTP

3 Answers

0 votes
answered Sep 22, 2010 by Vit Zyka (1,000 points)
edited Sep 22, 2010

Hello,

you wrote "it does not connect to the server". Does it mean that you got an exception? What was the Status and the Message properties of the exception? Can you send us a stack trace of the exception, please? You will get it by the following code:

try
{
  // ...
  ftp.Connect("My Domain Name", 990, tlsParameters, FtpSecurity.Implicit);
}
catch(exception ex)
{
  string stackTrace = ex.ToString();
  Console.WriteLine("Stack trace:\n{0}\n", stackTrace);
}
0 votes
answered Sep 23, 2010 by Shwetamber (290 points)
edited Sep 23, 2010

Hi, Thanks for reply. Below i am write the Log file details.

2010-09-23 11:24:52.812             Opening log file.

2010-09-23 11:25:06.421             ERROR Ftp(1) Info: System.InvalidOperationException: Not connected to the server. at Rebex.Net.Ftp.cOUusW() at Rebex.Net.Ftp.FileExists(String remotePath)

9/23/2010 12:33:10 PM             Trying to connect to FTP / SSL server....

9/23/2010 12:34:18 PM             Rebex.Net.FtpException: Timeout exceeded while waiting for welcome message. Make sure you are connecting to an ordinary FTP or explicitly secured FTP/SSL server. ---> Rebex.Net.FtpException: Timeout exceeded. at Rebex.Net.Ftp.QztfFZ() at Rebex.Net.Ftp.cgrDQE(Int32 ) at Rebex.Net.Ftp.Connect(String serverName, Int32 serverPort, TlsParameters parameters, FtpSecurity security) --- End of inner exception stack trace --- at Rebex.Net.Ftp.Connect(String serverName, Int32 serverPort, TlsParameters parameters, FtpSecurity security) at FTP_Client.Form1.connect(Ftp ftp) in C:\Inetpub\wwwroot\Transcription Manager\Form1.cs:line 509

9/23/2010 12:34:18 PM             Timeout exceeded while waiting for welcome message. Make sure you are connecting to an ordinary FTP or explicitly secured FTP/SSL server.

2010-09-23 12:34:32.531             Opening log file. 2010-09-23 12:34:34.062             ERROR Ftp(1) Info: System.InvalidOperationException: Not connected to the server. at Rebex.Net.Ftp.cOUusW() at Rebex.Net.Ftp.FileExists(String remotePath)

It is the code on line 509

ftp.Connect(Convert.ToString(regKey.GetValue("IPAddress")), Convert.ToInt32(regKey.GetValue("PortNo")), tlsParameters, FtpSecurity.Explicit);

Thanks & regards
Shwetamber Chourey
India

0 votes
answered Sep 29, 2010 by Vit Zyka (1,000 points)
edited Sep 29, 2010

Hi. It means that the connection was not successful and despite that you use FileExists() method. Check the connection success by try-catch block of code (see above).

...