Offset to Central Directory cannot be held in an Int64 - WeOnlyDo Discussion board

Offset to Central Directory cannot be held in an Int64 (wodFtpDLX / wodFtpDLX.NET)

by Computop, Monday, August 12, 2019, 17:44 (97 days ago)

I am connecting to an SFTP Server via FtpDLX. I am able connect and receive a .zip file without a problem.

However when I try to extract the file by using C# .Net ZipArchive library, I receive "Offset to Central Directory cannot be held in an Int64" error. I try to open with WinRar manually, then receive "Unexpected End of Archive" error.

I also connect through WinSCP with same credentials, download the file, and open it without an error. So the file is not corrupted.

Any idea why would that happen?

Offset to Central Directory cannot be held in an Int64

by wodSupport, Monday, August 12, 2019, 20:26 (97 days ago) @ Computop

Hi.

If you do binary-compare between file downloaded by wodFtpDLX and WinSCP, is it same or different? By theory, file cannot be corrupt, since SSH transport layer would fall apart if there is a mismatch in data being transferred, so error is somewhere else.

Perhaps you're doing ASCII transfer instead of binary?

Jasmine.

Offset to Central Directory cannot be held in an Int64

by ComputopGMBH, Tuesday, August 13, 2019, 08:44 (96 days ago) @ wodSupport

Hi, yes I am almost sure that's the problem.
What should be the "TransferMode" and "PassiveMode" values?

A sample C# code for GetFile would be nice, because I currently use Stream and string objects and I might need to take the file as bytearray[] but I don#t know how to.

Hi.

If you do binary-compare between file downloaded by wodFtpDLX and WinSCP, is it same or different? By theory, file cannot be corrupt, since SSH transport layer would fall apart if there is a mismatch in data being transferred, so error is somewhere else.

Perhaps you're doing ASCII transfer instead of binary?

Jasmine.

Offset to Central Directory cannot be held in an Int64

by wodSupport, Tuesday, August 13, 2019, 08:46 (96 days ago) @ ComputopGMBH

Hi

TransferMode should be set to Binary. Passive is ignored in SFTP protocol since there is no data connection.

You can find samples delivered with wodFtpDLX.NET installation, or few of them here:

https://www.weonlydo.com/code.asp?prod=wodFtpDLX.NET

If you need more specific sample let me know and we'll create one.

Jasmine.

Offset to Central Directory cannot be held in an Int64

by ComputopGMBH, Tuesday, August 13, 2019, 09:14 (96 days ago) @ wodSupport

I would like to have a specific sample please. Thank you.

Hi

TransferMode should be set to Binary. Passive is ignored in SFTP protocol since there is no data connection.

You can find samples delivered with wodFtpDLX.NET installation, or few of them here:

https://www.weonlydo.com/code.asp?prod=wodFtpDLX.NET

If you need more specific sample let me know and we'll create one.

Jasmine.

Offset to Central Directory cannot be held in an Int64

by wodSupport, Tuesday, August 13, 2019, 09:17 (96 days ago) @ ComputopGMBH

Hi.

Specific sample to do.. what? Can you be specific please? If it's GetFile.. then there's no sample since GetFile is just a simple call, and sample as this one:

https://www.weonlydo.com/code.asp?did=Active-Passive-File-Download

Describes the use.. What changes do you need on that sample to be more specific for your usage?

Jasmine.

Offset to Central Directory cannot be held in an Int64

by ComputopGMBH, Tuesday, August 13, 2019, 09:24 (96 days ago) @ wodSupport

Hi Jasmine, sure.

1. In the sample, I would like to see the settings for:
"Passive"
"StrictHost"
"TransferMode"

2. I don't want to write the file to disk directly. I would like to receive the file as "Stream", or byte array (byte[])
I do ask this sample because we already set TransferMode to binary and receivig the file as Stream may be causing the problem.

Thanks,

Hi.

Specific sample to do.. what? Can you be specific please? If it's GetFile.. then there's no sample since GetFile is just a simple call, and sample as this one:

https://www.weonlydo.com/code.asp?did=Active-Passive-File-Download

Describes the use.. What changes do you need on that sample to be more specific for your usage?

Jasmine.

Offset to Central Directory cannot be held in an Int64

by wodSupport, Tuesday, August 13, 2019, 20:35 (96 days ago) @ ComputopGMBH

Hi.

This would be basic sample that use memory stream and binary transfer:


            WeOnlyDo.Client.FtpDLX ftp1 = new WeOnlyDo.Client.FtpDLX();
            ftp1.Hostname = "your_hostname";
            ftp1.Login = "your_login";
            ftp1.Password = "your_password";
            ftp1.Blocking = true;
            ftp1.Connect();

            ftp1.TransferMode = WeOnlyDo.Client.TransferModes.Binary;

            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            ftp1.GetFile(ms, "/bin/bash");

            ftp1.Disconnect();

Jasmine.