Topic "Server unexpectedly closed network connection. ( C# , win7 to VMS, with dh-group1-sha1)"

Author Message
mafis
[View user's profile]

Joined: 2016-07-24
Posts: 3
Location: Hungary
Hi Martin, hi Winscp-Team,


in my report "***" mean "I remmoved a part of string".
I use "win7", "Open-VMS 8.3", "winscp v5.9", "VisualStudio 2015 Express"

So when I run the follow command in cmd.exe:

"C:\Program Files\WinSCP\winscp.com" /command "open sftp://cba***:haf***@5.175.***.*** -hostkey=""*"" -rawsettings KEX=""dh-group1-sha1,dh-group14-sha1,dh-gex-sha1,rsa,WARN"" " "pwd" "exit" /log="C:\Users\***\Desktop\winscp_bug\batch.log" /loglevel=2

then it is workd. OK Smile
("dh-group1-sha1" must be used for VMS )
I attached thw log from batch-run too.(batch.log)

But when I run my "C#_code.cs" (it is attached)
I get this output with error :

dumpCommand: pwd
output :
ErrorOutput:
IsSuccess : False
ExitCode : 0
WinSCP.SessionRemoteException: Server unexpectedly closed network connection.
Authentication log (see session log for details):
Using username "cba***".
Authentication failed.
Server unexpectedly closed network connection.
Authentication log (see session log for details):
Using username "cba***".
Authentication failed.

The "session.DebugLogPath" and "session.SessionLogPath" are attached too. (c#_code.deblog, c#_code.log)

IP, loginname, password, winscp version are same.
When I mixd run the "batch" and "c#_code" i have the same error for "c#_code" and the batch is always error-free.

I read the forum and the documentation but i din'nt find explanation or i am not enought adept.
I hope you can help for me.
Thanks in advance!

Csaba


ps.: sorry for my poor english
winscp_bug.rar (14.11 KB) Private file

Description: all attached file is here and compressd

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
The ExecuteCommand method tries to open shell and execute the pwd command there, what will hardly work on VMS.
See https://winscp.net/eng/docs/remote_command

Read the Session.HomePath instead.
https://winscp.net/eng/docs/library_session#homepath
mafis
[View user's profile]

Joined: 2016-07-24
Posts: 3
Location: Hungary
Thanks for the links!

I tried to write out the session.HomePath after session.Open:
log.wrln("home-path: >" + session.HomePath+"<");
home-path: >/disk$data_4/user/cba***<

it worked so the winscp can use the VMS.

I tried the command line too :
"C:\Program Files\WinSCP\winscp.com" /command "open sftp://cba***:haf***@5.175.***.*** -hostkey=""*"" -rawsettings KEX=""dh-group1-sha1,dh-group14-sha1,dh-gex-sha1,rsa,WARN"" " "pwd" "exit"
and
"C:\Program Files\WinSCP\winscp.com" /command "open sftp://cba***:haf***@5.175.***.*** -hostkey=""*"" -rawsettings KEX=""dh-group1-sha1,dh-group14-sha1,dh-gex-sha1,rsa,WARN"" " "ls" "exit"
It worked too. I can see the ls's output.

I tried other command to run in C# :
dumpCommand = "ls";
but the error is same: "Server unexpectedly closed network connection."

Can you help me with other links?
Thanks in advance!
Csaba
mafis
[View user's profile]

Joined: 2016-07-24
Posts: 3
Location: Hungary
On VMS :
> show symbol pwd
PWD == "SHOW DEFAULT"

"symbol" is similar to "alias" on linux.

Csaba
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
I mean you can hardly make the ExecuteCommand work on the VMS in general. Why do you want to call the ls command? Use the ListDirectory.
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