Archived
This forum has been archived. Please start a new discussion on GitHub.
How can I get the percentage of file transfer
ask:
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?
answer:
I would use some callback interface to do this. You could do something like this:
Code:
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?
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?
answer:
I would use some callback interface to do this. You could do something like this:
Code:
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?
0