Solved

byte-by-byte metering

Posted on 2003-10-21
15
251 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

820 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