0

Really hope you can assist with my query.

I am currently creating an application to integrate a SFTP server with NetSuite's file cabinet. All my code works fine when executing the application from my machine (Windows 7), but when I execute this application on a server (Windows Server 2003), I run into the following error:

System.Net.Sockets.SocketException: A 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 10.81.200.87:22
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port)
   at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeout)

I am using SharpSSH to connect to the SFTP server.

Some of the steps I have performed to diagnose this issue:

  1. I have pinged the host address, which returns all packets successfully
  2. Removed certificate restrictions using

    System.Net.ServicePointManager.ServerCertificateValidationCallback

  3. I also used the following in case of incorrect '\\' I could have added to the host address:

    Dns.GetHostEntry(host);

Indeed, I know Windows Server 2003 is very old but the business I work for have no plans to upgrade this so I just have to work with what I have. Of course, I had to downgrade the application to the .NET 3.5 framework to make it compatible.

Any help on resolving this would be most appreciated.

Regards AWB

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Arif WB
  • 186
  • 1
  • 13
  • 1
    Can you connect to sftp using any other sftp product, eg, such as like the one by the guy who made putty – BugFinder Aug 04 '16 at 12:59
  • 1
    Ensure the servers firewall is allowing the required outbound ports? - whitelist your application to test – Alex K. Aug 04 '16 at 13:01
  • Hi - thanks for the feedback. Where would I check the servers firewalls on FileZilla? This is my only route to connecting to the server. – Arif WB Aug 04 '16 at 13:05
  • @BugFinder I have not tried connecting with any SFTP product, just directly attempting to download the file via the code I have written. – Arif WB Aug 04 '16 at 13:06
  • 2
    Like most things, establish it can happen before panicking your code doesnt work – BugFinder Aug 04 '16 at 13:07
  • As @BugFinder suggested, first try to connect with any standalone SFTP client to the SFTP server from your Windows 2003 server. Use PuTTY psftp, WinSCP, FileZilla, or any other. Until you know you have a connectivity, you do not have a programming question. – Martin Prikryl Aug 04 '16 at 13:33
  • thanks @Martin Prikryl I have attempted to log into the SFTP server using WinSCP and the "Network error: connection timed out" message is thrown. Definitely some issue with the server itself. Ideas for resolution? Firewall is set to "not protected" – Arif WB Aug 04 '16 at 17:09
  • Just to add - I have already added "winscp.exe" as an exception in the windows firewall setting. – Arif WB Aug 04 '16 at 17:14
  • Once again, if you cannot connect with a standalone FTP client, you do not have a programming question. Please move your question to [su]. It's [off-topic](http://stackoverflow.com/help/on-topic) here. – Martin Prikryl Aug 04 '16 at 18:52

0 Answers0