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

asked 21 Sep '10, 13:54

Shwetamber's gravatar image

Shwetamber
282
accept rate: 0%


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);
}
link

answered 22 Sep '10, 12:16

Vit%20Zyka's gravatar image

Vit Zyka
912
accept rate: 8%

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

link

answered 23 Sep '10, 07:25

Shwetamber's gravatar image

Shwetamber
282
accept rate: 0%

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).

link

answered 29 Sep '10, 16:09

Vit%20Zyka's gravatar image

Vit Zyka
912
accept rate: 8%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×152
×141
×20

Asked: 21 Sep '10, 13:54

Seen: 982 times

Last updated: 31 Mar '11, 01:22