Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-08-2008
fengshengheli fengshengheli is offline
Registered User
 
Name: zhang mq
Organization: sddl
Project: substation
 
Join Date: Sep 2008
Posts: 4
How can I get the percentage of file transfer

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?
Reply With Quote
  #2 (permalink)  
Old 09-08-2008
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,564
Hi,

You might be able to use the Ice::Stats interface for this purpose. See here in the Ice manual for more information.

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 09-09-2008
fengshengheli fengshengheli is offline
Registered User
 
Name: zhang mq
Organization: sddl
Project: substation
 
Join Date: Sep 2008
Posts: 4
I try to use Ice::Stats,but I dont' think it works well.

Thanks for your help! I write a client and a server using Ice::Stats.I found that the Ice::Stats only get the bytes sent and recevied between client and server.But it does not meet my requirement.There are my client and server in the accessories.
My develop environment:winxpsp2 vc2005 Ice3.3.0

In my project,clients and server works like this:
1、The client invokes function getFile, and this returns true or false.True means the server get the file from the other computer success,false means some error occurs.
2、The server get the file by socket or by seriport,and send percentage to client.Return true or false at the end.(The problem is how to send messages to the client and how to receive messages from the server.)
3、The client doesn't get the file from the server in fact,but only needs to get informations the server happenning.

My English is poor,so I don't know if you understand what I mean.Thanks.
Attached Files
File Type: zip Projects.zip (25.0 KB, 6 views)
Reply With Quote
  #4 (permalink)  
Old 09-09-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,088
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);
};
If you want to use Ice to transfer the files themselves, you might also want to read my article "Optimizing Performance of File Transfers" in http://www.zeroc.com/newsletter/issue20.pdf.
Reply With Quote
  #5 (permalink)  
Old 09-09-2008
fengshengheli fengshengheli is offline
Registered User
 
Name: zhang mq
Organization: sddl
Project: substation
 
Join Date: Sep 2008
Posts: 4
Thank you very much!

Thanks.Problem has already been resolved under your help.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
transfer file with Ice zhongshiz Help Center 4 10-23-2007 10:00 PM
File transfer and threading. EmmanuelOga Help Center 3 08-15-2006 10:41 AM
Any Example that do file transfer out there alexm Help Center 2 04-06-2006 06:31 PM
How can I develop a File transfer application?question 1 xiehua Help Center 11 12-05-2003 11:39 PM


All times are GMT -4. The time now is 11:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.