?
Solved

byte-by-byte metering

Posted on 2003-10-21
15
Medium Priority
?
256 Views
Last Modified: 2013-12-25
Hi experts,

I have a CGI (written in C++) that a user calls to download a file.  When the script executes, it streams the file back to the user.  I would like to know how I can verify if the download was successfull.  I have read about byte-by-byte metering but I don't know how to implement this.

Can anyone help?

Thanks,

dannyguindi
0
Comment
Question by:dannyguindi
  • 7
  • 6
14 Comments
 

Author Comment

by:dannyguindi
ID: 9660719
nobody know how to do this?
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9661916
HTTP transactions take place over TCP sockets. TCP offers a reliability assurance: if the socket reports that the last byte of the file has been transmitted, then it has been acknowledged as received by the peer at the other end. Most of the time, this level of assurance is adequate to know that the download was successful.

To get an even greater degree of assurrance, you would need an additional exchange between the browser and server, perhaps even a dialog with the user. For instance, you could use an onSubmit routine to request the download _before_ doing the submit action. The arrival of the second request could be interpreted to mean that the download action completed successfully. A size or checksum of the downloaded file might even be included.
0
 

Author Comment

by:dannyguindi
ID: 9682191
I don't understand what you mean by an exchange between the server and the browser.  When a user call my CGI script, it prompts hime to save the file or open it, like any other download.  If the user selects to save it, there is no other interaction between my script and the user.  who would be making the second call to my script to verify that the download completed successfully?

Any C code would be mostly helpful...

(increasing points to 150)
0
Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

 
LVL 20

Expert Comment

by:jmcg
ID: 9684096
I'm not a JavaScript programmer, so I don't know that this can be done. But it certainly cannot be done solely on the server side, which is why you are having a hard time visualizing what the CGI code would look like.

In my primitive vision, the onSubmit routine, client-side, would do something like:

  dl_window = window.open
  dl_window.location = dl_file_URL

then wait around a short while for the download to complete, then ask the user to confirm( ) the download was successful, and only then submit the underlying form.



0
 

Author Comment

by:dannyguindi
ID: 9820278
I don't want to depend on the user confirming the download.  If the user doesn't confirm, then I have the same problem I had before!

Increasing points to 200...
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9820975
This question is now old enough that increasing the points is unlikely to attract additional attention. I suggest that you ask in Community Support to close this question (I think my responses are worth PAQing) and refund your points. You can then ask again in a way that more clearly sets out what you are attempting to do, what solutions you've already considered and rejected, and any other constraints you have on what you'll accept as a solution.

I still think that there is no straightforward solution that meets all of your criteria. To do exactly what you ask for would involve a violation of the security model the web browser implements to ensure that a web site cannot read an arbitrary file from the user's computer. But perhaps someone else can think of a slight weakening of what you want that will come close enough to fulfilling your goal.
0
 

Author Comment

by:dannyguindi
ID: 9821275
ok, let me see if I can explain this better before I ask to close the question.

Assume I have a software product that I want to sell.  Once a person pays for it, I want to allow him to download it, but only ONCE.  If something fails during the download I want to allow the user to try to download it again.  But, I don't want anybody telling me that the download didn't work when in fact it did, and they are just trying to get a free copy of my software.  That's why I want to check if the download completes successfully without asking the user.

Does this make any more sense?  I know there are companies that do this, and I would like to know how.

Thanks.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9829466
If the download succeeds, a dishonest customer only has to copy the download to make extra copies. I'll go back to my original suggestion: once the 'write' call for the socket reports the last byte of the file has been transmitted, you can assume the download has succeeded.

0
 

Author Comment

by:dannyguindi
ID: 10319300
I am still hoping for some help on this matter!   Increasing points...
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10319434
I don't have any more ideas to help you.

Increasing the points is unlikely to attract new notice to a question that now appears on the second page of the question list for this section. I'll recommend again that you ask a new question. It could be a question that merely points back to this one or, better, one that is self-contained and outlines your whole problem.

You can ask in

http://www.experts-exchange.com/Community_Support/

to have this question PAQed and your points refunded (I have no objection to you getting all of your points back on this one).
0
 

Author Comment

by:dannyguindi
ID: 10322419
Thanks, I will do just that.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10324720
I recommend PAQ, refund, as mentioned earlier.

Dannyguindi, you were going to ask this again, right?

0
 

Author Comment

by:dannyguindi
ID: 10327483
yes, I am going to update and repost this question.
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 10362566
Closed, 250 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question