Solved

byte-by-byte metering

Posted on 2003-10-21
15
247 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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 …
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

706 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

16 Experts available now in Live!

Get 1:1 Help Now