Boost logo

Boost :

From: Adrovic, Ervin (ervin.adrovic_at_[hidden])
Date: 2008-05-21 03:05:41

Thanks David,

Since I am new with boost any sample hot to do that?


-----Original Message-----
From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of David Abrahams
Sent: Wednesday, May 21, 2008 08:33
To: boost_at_[hidden]
Subject: Re: [boost] MPI and file copy

on Tue May 20 2008, "Adrovic, Ervin" <> wrote:

> Hi,
> I would like to copy binary files from host A to host B. That for I was thinking to use boost MPI and open file on one side read buffer and send it to other side.
> bool SendFile(std::ifstream* inputFile) {
> bool ret = true;
> if (inputFile != NULL)
> {
> CData data;
> while (inputFile->eof() == false)
> {
> inputFile->read(data.GetDataBuffer(), data.GetDataBufferSize());
> std::streamsize nRead = inputFile->gcount ();
> data.SetDataLen(nRead);
> GetWorld().send(1, MSG_CDATA, data);
> }
> inputFile->close();
> }
> return ret;
> }
> To complicate a litle bit I may use filters (ZIP, Encrypt, ...) for this operation.
> Any idea/sample hoe to implement that?
> Is it possibale to do steaming using MPI?

The only thing you need in order to ship bytes over Boost.MPI is a Boost.Serialization-compatible interface to those bytes.

I would build a small serializable wrapper that, when serialized out to an Archive, reads the bytes to be archived from the underlying ifstream. Then you do the opposite procedure on the receiving end.


Dave Abrahams
BoostPro Computing
Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at