Home Help Center

How can I get the percentage of file transfer

fengshenghelifengshengheli Member zhang mqOrganization: sddlProject: substation
I write the slice like this:

bool getFile(string filename);

The server get the file from a remote machine and return true or false when transfering completed. I don't know how to send messages to the client when transfering.

How can I get the percentage of file transfer when the client invoking this function? Can you help me?

I would use some callback interface to do this. You could do something like this:

interface TransferFileCallback
void transferred(float f); // Percentage transferred between 0 and 1.
void failed(string reason); // Transfer failed.

interface TransferFile
// Returns true if the file will be transferred, false otherwise.
bool getFile(string filename, PercentageCallback* cb);

New Question:
It works well when the client-side using vc++. But my client is using PHP. How can I create callback in the php? I find not "Server-Side Slice-to-PHP Mapping" in the pdf. What can I do in this case?


  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    I'd suggest to study the Chat demo, in particular its PHP client.

    Best regards,
Sign In or Register to comment.