|| | |||Browse by category|
http://www.kbpublisher.com - http://www.kbpublisher.com
[b]text[/b] - Bold text.
[u]text[/u] - Underline text.
[i]text[/i] - Italic text.
[color=green]text[/color] - Colored text.
[url]kbpublisher.com[/url] - kbpublisher.com
[url=kbpublisher.com]text[/url] - text
[email]email@example.com[/email] - firstname.lastname@example.org
[h1]text[/h1] - Caption text.
- item 1
- item 2
- item 1
- item 2
When downloading a binary file from an FTP or HTTP server using Tools.h++ Professional, the size of the file that I receive is different from the file on the server.
The problem is caused by most systems defaulting to using ASCII as their download method, which will interpret the data, instead of sending it in it's raw form. There are three locations when this interpretation can occur.
- The Server. This usually occurs in the RWIFtpClient/Agent classes, in which the data is sent by default in ASCII format by some servers.
- The RWStreamCoupler class. The RWStreamCoupler class is used to redirect information on an input stream directly to an output stream (For example, from a socket to a local file.) The StreamCouple itself can be set to either interpret the data or simply pass it as is, and if it is set to interpret the data in a binary file, the resulting file may be corrupted.
- The File Stream A file stream itself can be set to either BINARY or ASCII format. If the file is opened in ASCII mode, and BINARY data is streamed to it, data corruption may occur.
Each of the above causes has it's own solution.
If the server is formatting the data as ASCII before sending it, then you will need to tell the server to send it as BINARY data instead.
In the RWIFtpAgent class, that can be done in the calls to
get(). Both of these functions have an optional third argument that designates the type of transfer that should occur. In order to force the server to send the data in binary format, you will need to pass the enum
'tmode_binary' to the
put() call that you are making.
RWSocketPortal portal; RWIFtpAgent agent(