Solved

byte-by-byte metering

Posted on 2003-10-21
15
250 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
15 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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)

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now