Error: WinSCP.SessionRemoteException: Network error: Connection to "IP-address" timed out.

Advertisement

rohiniagalave
Joined:
Posts:
1
Location:
Pune

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,
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);
 
}
Giving me
Network error : connection time out
Attached screenshot of it. Please help me out.

Network_Issue_SFTP.PNG

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,603
Location:
Prague, Czechia

Re: Error: WinSCP.SessionRemoteException: Network error: Connection to "IP-address" timed out.

And can you connect to that IP address using any GUI/commandline SFTP client application running on the same machine, where your C# code it failing? If you can, post its log file and session log file from your C# code.

Reply with quote

Advertisement

You can post new topics in this forum