login about faq
0
1

Hi there, i have some trouble with the sFTP Componente. Connection to sFTP Server works fine, but as soon as i want to start uploading a file bei Opening it, the returned handle is always null and i cant write my file. Ideas? Any help appreciated !

This is part of my Code:

--Assembly ChilkatDotNet45.dll, v9.5.0.51 internal SFtp sftp { get; set; } sftp = new SFtp(); . . Successfully open connection . . string handle = null; handle = sftp.OpenFile(ftpTargetFileName, "writeOnly", "createNew");

asked Aug 17 '15 at 05:54

mstoep's gravatar image

mstoep
11


The 1st questions a programmer might ask when debugging anything is: "What sources of information exist that will provide more details about what happened?".

With Chilkat, the answer is the LastErrorText property. There may be other source w/ Chilkat -- such as properties involving session logs, session log files, DebugLogFilePath, etc. Review the properties and methods for a given Chilkat class to see what sources of debugging information are available -- and then use them to get more information about what transpired.

The LastErroText property is always the 1st place to look w/ Chilkat. All classes also have a VerboseLogging property to control the verbosity of the LastErrorText.

In summary: Start by examining the contents of the sftp.LastErrorText property to see what happened.

link

answered Aug 17 '15 at 11:35

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

edited Aug 17 '15 at 11:35

Thank You for the advice. Already did that, but the LastErrorText did not help much: ChilkatLog: IsConnected: DllDate: Jun 23 2015 ChilkatVersion: 9.5.0.51 UnlockPrefix: XXX Username: XXX Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 1 SshVersion: SSH-2.0-SSHBlackbox.8 SftpVersion: 3 --IsConnected --ChilkatLog

link

answered Aug 18 '15 at 06:41

mstoep's gravatar image

mstoep
11

The LastErrorText shows the last method called. You're showing the LastErrorText for the IsConnected method call. You must get the LastErrorText before making another call on the object, because the LastErrorText will be overwritten with the new method call...

(Aug 18 '15 at 08:39) chilkat ♦♦

OK, when i get that right, thats what i do:

1.Debug LastErrorText: ChilkatLog: IsConnected: DllDate: Jun 23 2015 ChilkatVersion: 9.5.0.51 UnlockPrefix: XXX Username: XXX Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 1 SshVersion: SSH-2.0-SSHBlackbox.8 SftpVersion: 3 --IsConnected --ChilkatLog

2.handle = sftp.OpenFile(ftpTargetFileName, "writeOnly", "createNew");

3.Debug LastErrorText: ChilkatLog: IsConnected: DllDate: Jun 23 2015 ChilkatVersion: 9.5.0.51 UnlockPrefix: XXX Username: XXX Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 1 SshVersion: SSH-2.0-SSHBlackbox.8 SftpVersion: 3 --IsConnected --ChilkatLog

As You can see, there is NO CHANGE to the Errortext and the Return Value for sftp.OpenFile is NULL

link

answered Aug 18 '15 at 08:56

mstoep's gravatar image

mstoep
11

Hello, is there any new status for this issue?

link

answered Aug 25 '15 at 07:25

Jochen%20Kluger's gravatar image

Jochen Kluger
1

The LastErrorText shows the last method called. Again, it is showing "IsConnected" as being the last method called. Look more closely at your code. Perhaps you have an IF statement immediately following the call to OpenFile, in the IF condition you are calling IsConnected. For example:

handle = sftp.OpenFile(...)
if (!sftp.IsConnected()) {
    textBox1.Text = sftp.LastErrorText;  <--- This would get the LastErrorText for IsConnected.
    }

Or.. check to see if the object instance used to get the LastErrorText is the same as the object instance that called OpenFile.

link

answered Aug 26 '15 at 09:25

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Hello, no matter what method I execute, LastErrorText always contains IsConnected. But in my latest tests, an error is contained: WSAECONNABORTED An established connection was aborted by the software in your host machine. For more information see this Chilkat Blog post: http://www.cknotes.com/?p=91 But the blog post did not help much, because I do not send data, just open a file.

The process works until I try to upload a file - Login and file listing are no Problem.

LastErrorText before OpenFile: ChilkatLog: IsConnected: DllDate: Jun 23 2015 ChilkatVersion: 9.5.0.51 UnlockPrefix: * Username: * Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 1 SshVersion: SSH-2.0-ITSG SftpVersion: 3 --IsConnected --ChilkatLog

Then I execute this command: string handle = sftp.OpenFile(ftpTargetFileName, "writeOnly", "createNew"); And the handle stays null.

LastErrorText after OpenFile: ChilkatLog: IsConnected: DllDate: Jun 23 2015 ChilkatVersion: 9.5.0.51 UnlockPrefix: * Username: * Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 1 SshVersion: SSH-2.0-ITSG SftpVersion: 3 SocketError: WSAECONNABORTED An established connection was aborted by the software in your host machine. For more information see this Chilkat Blog post: http://www.cknotes.com/?p=91 --IsConnected --ChilkatLog

--SessionLog start--- TRAN Established TCP/IP connection with SSH server TRAN> SSH-2.0-PuTTY_Release_0.63 TRAN< SSH-2.0-ITSG TRAN> KEXINIT TRAN packetLen: 1476 TRAN< KEXINIT TRAN Key Algorithms: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1 TRAN Host Key Algorithms: ssh-rsa TRAN Out Encryption: 3des-cbc,blowfish-cbc,twofish256-cbc,twofish192-cbc,twofish128-cbc,aes256-cbc,aes192-cbc,aes128-cbc,serpent256-cbc,serpent192-cbc,serpent128-cbc,arcfour,idea-cbc,cast128-cbc,none,des-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-ctr,blowfish-ctr,twofish128-ctr,twofish192-ctr,twofish256-ctr,serpent128-ctr,serpent192-ctr,serpent256-ctr,idea-ctr,cast128-ctr,arcfour128,arcfour256 TRAN In Encryption: 3des-cbc,blowfish-cbc,twofish256-cbc,twofish192-cbc,twofish128-cbc,aes256-cbc,aes192-cbc,aes128-cbc,serpent256-cbc,serpent192-cbc,serpent128-cbc,arcfour,idea-cbc,cast128-cbc,none,des-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-ctr,blowfish-ctr,twofish128-ctr,twofish192-ctr,twofish256-ctr,serpent128-ctr,serpent192-ctr,serpent256-ctr,idea-ctr,cast128-ctr,arcfour128,arcfour256 TRAN Out MAC: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,none,hmac-ripemd160,hmac-ripemd,hmac-ripemd160@openssh.com,hmac-sha256@ssh.com,hmac-sha256-96@ssh.com,umac-32@openssh.com,umac-64@openssh.com,umac-96@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 TRAN In MAC: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,none,hmac-ripemd160,hmac-ripemd,hmac-ripemd160@openssh.com,hmac-sha256@ssh.com,hmac-sha256-96@ssh.com,umac-32@openssh.com,umac-64@openssh.com,umac-96@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 TRAN Out Compress: zlib@openssh.com,zlib,none TRAN In Compress: zlib@openssh.com,zlib,none TRAN> KEX_DH_GEX_REQUEST TRAN packetLen: 276 TRAN< KEX_DH_GEX_GROUP/KEXDH_REPLY TRAN> KEXDH_INIT TRAN packetLen: 572 TRAN< KEX_DH_GEX_REPLY TRAN RSA signature verified TRAN> NEWKEYS TRAN packetLen: 12 TRAN< NEWKEYS TRAN SSH Key Exchange Success. TRAN> IGNORE TRAN> SERVICE_REQUEST TRAN Packet start: 00 00 00 1C 06 78 9C 62 63 60 60 E0 29 2E CE D0 TRAN packetLen: 28 TRAN< SERVICE_ACCEPT TRAN> USERAUTH_REQUEST (none) TRAN Packet start: 00 00 00 3C 05 20 63 A0 80 61 41 62 71 71 79 7E TRAN packetLen: 60 TRAN< USERAUTH_FAILURE TRAN> USERAUTH_REQUEST (password) TRAN Packet start: 00 00 00 0C 08 90 09 40 97 1B 10 7A 92 98 DF CC TRAN packetLen: 12 TRAN< USERAUTH_SUCCESS TRAN> CHANNEL_OPEN TRAN Packet start: 00 00 00 1C 10 00 45 33 C0 00 2B 88 68 60 00 08 TRAN packetLen: 28 TRAN< CHANNEL_OPEN_CONFIRMATION TRAN> CHANNEL_REQUEST: subsystem TRAN Packet start: 00 00 00 0C 06 A0 64 10 05 10 84 39 1F 11 0E 8D TRAN packetLen: 12 TRAN< CHANNEL_SUCCESS SFTP> Sending SSH_FXP_INIT TRAN> CHANNEL_DATA TRAN NumBytes: 9 TRAN Packet start: 00 00 00 1C 12 40 B1 60 11 46 06 06 80 00 F7 57 TRAN packetLen: 28 TRAN< CHANNEL_WINDOW_ADJUST TRAN Packet start: 00 00 01 0C 10 5C 50 4D 4B 03 31 10 4D AB 50 2D TRAN packetLen: 268 TRAN< CHANNEL_DATA TRAN payload size: 381 SFTP< Received SSH_FXP_VERSION SFTP> Sending SSH_FXP_OPENDIR TRAN> CHANNEL_DATA TRAN NumBytes: 13 TRAN Packet start: 00 00 00 1C 0B 08 1A F8 0C 82 40 CC 9B 06 89 10 TRAN packetLen: 28 TRAN< CHANNEL_DATA TRAN payload size: 26 SFTP< Received SSH_FXP_HANDLE SFTP> Sending SSH_FXP_READDIR TRAN> CHANNEL_DATA TRAN NumBytes: 17 TRAN Packet start: 00 00 00 6C 09 00 C1 64 66 02 F1 D4 0C 50 3C 40 TRAN packetLen: 108 TRAN< CHANNEL_DATA TRAN payload size: 162 SFTP< Received SSH_FXP_NAME SFTP> Sending SSH_FXP_READDIR TRAN> CHANNEL_DATA TRAN NumBytes: 17 TRAN Packet start: 00 00 00 2C 11 80 60 2E D4 04 62 D5 54 68 C2 01 TRAN packetLen: 44 TRAN< CHANNEL_DATA TRAN payload size: 50 SFTP< Received SSH_FXP_STATUS SFTP> Sending SSH_FXP_OPEN TRAN> CHANNEL_DATA TRAN NumBytes: 57 TRAN Packet start: 00 00 00 0C 06 50 02 48 39 40 F1 24 8D 31 1A 72 TRAN packetLen: 12 TRAN< CHANNEL_EOF SFTP! Failed to read SFTP packet. -- SessionLog end-----

link

answered Aug 26 '15 at 09:50

Jochen%20Kluger's gravatar image

Jochen Kluger
1

Something external is interfering with the communications. Check anti-virus, firewalls, etc. (the connection can be disrupted by external agents both on local and/or remote sides). These sorts of problems are always due to external security infrastructure getting in the way...

link

answered Aug 26 '15 at 09:56

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Hi, I think I solved the problem. Sometimes it helps to step back and look at it one step after the other. The handle from the OpenDir command, that was fired before was not closed. After closing it, everything works.

Could this result in the described behaviour or just something else changed - infrastructure, Server, etc.?

link

answered Aug 26 '15 at 11:37

Jochen%20Kluger's gravatar image

Jochen Kluger
1

I think you've solved the problem. :-)

link

answered Aug 26 '15 at 11:41

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×201

Asked: Aug 17 '15 at 05:54

Seen: 2,013 times

Last updated: Aug 26 '15 at 11:41

powered by OSQA