Topic "Host does not exist"

Author Message
VirtKitty

Guest


Greetings...

I am trying to use SFTP to transfer a file from within VB.NET. I've set up a session and can connect to the server when using the Commander interface. Here's my code in VB.NET
' Run hidden WinSCP process
Dim winscp As Process = New Process()
winscp.StartInfo.FileName = gstrFTPProcessLocation 'Location of WinSCP.com (usually C:\Program Files\WinSCP\winscp.com)
winscp.StartInfo.Arguments = "/log=" + LogName
winscp.StartInfo.UseShellExecute = False
winscp.StartInfo.RedirectStandardInput = True
'winscp.StartInfo.RedirectStandardOutput = True
winscp.StartInfo.CreateNoWindow = True
winscp.Start()

' Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort")
winscp.StandardInput.WriteLine("option confirm off")
winscp.StandardInput.WriteLine("open " & gstrFTPSession) 'This is a session you must setup in WinSCP
winscp.StandardInput.WriteLine("ls")
winscp.StandardInput.WriteLine("put " & strOutFile)
winscp.StandardInput.Close()

' Collect all output (not used in this example)
'Dim output As String = winscp.StandardOutput.ReadToEnd()

' Wait until WinSCP finishes
winscp.WaitForExit()

I get an exit code of 1 and do not get a log file. This code had been working, but I'm connecting to a new FTP site and it's bombing. If I comment out CreateNoWindow, I see the error message is "Host does not exist".

When I use the console (winscp.com) directly from a command line, I get "Host does not exist" as well. I can connect to other stored sessions just fine thru the console. Just this one site it isn't happy with. And when I use commander, it connects to my stored session just fine.

Any help greatly appreciated.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25016
Location: Prague, Czechia
Are you able to get log if you run WinSCP manually and type the open command in console?
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License