"bad packet length xxxxx" error when retrieving only some secure FTP sub directory listings

May 31, 2013 at 8:12 PM
I get an error "bad packet length xxxxx" when retrieving some sFTP sub directory listings. My connection is successful. FileZilla ftp client (default settings) has exact same issue with same dir's, but CoreFTP Lite (default settings) can list all dir's easily. If I move out a few files then I can list the sub directory's contents.

I heard it is because the sFTP server allows BOM as optional or something...

Are there any workarounds with SSH.NET C# library (latest version from https://sshnet.codeplex.com/).
using (var sftp = new SftpClient(s.Host, s.UserName, s.Password))
  foreach (var d in sftp.ConnectionInfo.Encryptions.Where(p => p.Key != "aes256-cbc").ToList())
    sftp.ConnectionInfo.Encryptions.Remove(d.Key);   // remove all Encryptions but the one listed above

  sftp.ConnectionInfo.Encoding = System.Text.UTF8Encoding.ASCII;
  sftp.Connect();  // always connects fine
  var files = sftp.ListDirectory("/SubDirectory");  // Error here for some sub dirs
Jun 4, 2013 at 5:52 PM
Edited Jun 5, 2013 at 2:43 PM
If 235 files or less in directory then I can retrieve a dir listing using the SSH.NET library for c#.
If 250 files or less in directory then I can retrieve a dir listing using FileZilla.
I am connecting to a secure FTP server (SSH-2.01.36 Globalscape).