Error: WinSCP.SessionRemoteException: Network error: Connection to "IP-address" timed out.
Hi Team,
I am trying to upload a file using SFTP through C# code.
Below code I have written,
Giving me
I am trying to upload a file using SFTP through C# code.
Below code I have written,
SessionOptions sessionOptions = new SessionOptions { Protocol = Protocol.Sftp, HostName = "", UserName = "", Password = "", PortNumber = 2222, SshHostKeyFingerprint = "" }; using (Session session = new Session()) { session.ReconnectTime = new TimeSpan(0, 0, 30); // Connect session.Open(sessionOptions); TransferOptions transferOptions = new TransferOptions(); transferOptions.TransferMode = TransferMode.Binary; TransferEventArgs transferResult; transferResult = session.PutFileToDirectory(@"C:\Users\rohiniag\Desktop\DemoPDF2.pdf", @"\SFTFIIles\", false, transferOptions); Console.WriteLine(transferResult.Touch); }
Attached screenshot of it. Please help me out.Network error : connection time out