Trouble transferring binary files with FTP examples

Article ID: 812
Last updated: 02 Feb, 2008
Article ID: 812
Last updated: 02 Feb, 2008
Revision: 1
Views: 2670
Posted: 29 Sep, 1998
by Dean J.
Updated: 02 Feb, 2008
by Dean J.
Problem


When using the Rogue Wave FTP examples to transfer binary files, the transferred files are the wrong size.


Cause


The RWStreamCoupler class which streams all the incoming data from the socket connection to the specified outfile defaults to ASCII mode which will interpret the data instead of streaming it out in its pure binary form.


Action


When modifying the example, be sure to use a binary RWStreamCoupler. There are 2 ways to do this:

Construct the RWStreamCoupler as binary:
    RWStreamCoupler couple(RWStreamCoupler::mode_binary);

OR Set the RWStreamCoupler to binary after it has been constructed:
    RWStreamCoupler couple;
    couple.setMode(RWStreamCoupler::mode_binary);
This article was:   Helpful | Not helpful
Report an issue
Article ID: 812
Last updated: 02 Feb, 2008
Revision: 1
Views: 2670
Posted: 29 Sep, 1998 by Dean J.
Updated: 02 Feb, 2008 by Dean J.

Others in this category