Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I need to verify what data wasn't downloaded yet. For example, how does Twitter or Facebook verify if a specific client has already dowloaded a piece of information?

When a mobile app like twitter make a request to twitter.com will receive only new data but not data that it has already downloaded in old requests.

share|improve this question

closed as unclear what you're asking by MichaelT, GlenH7, Kilian Foth, gnat, Dan Pichelman Sep 12 '13 at 20:54

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
-1 very vague question. –  DMin Jun 23 '11 at 8:09
    
Di Motta: Please don't explain more in a comment. Please update the question to explain more. After you update the question, please delete the comment. –  S.Lott Jun 23 '11 at 9:53

3 Answers 3

up vote 3 down vote accepted

It depends on the precise requirement.

For something like Facebook / Twitter where it's not the end of the world if something gets returned twice the simplest mechanism would be to store a last successful download timestamp against each user/client and only return data more recent than that point.

If you need a guarantee that each item has been delivered and delivered only once (for instance for financial transactions) then the solution will likely be more complex and involve a series of calls - the client requesting data, the server returning the data, the client confirming that it has received and processed the data and the server acknowledging that. In that case I'd also be inclined to mark each record as downloaded individually rather than rely on a timestamp.

You also need to think about whether you're dealing with single or multiple clients and store the timestamp or whatever appropriately (that is against each client instance rather than each user) and make sure you have a mechanism for accurately identifying each client.

share|improve this answer

I hardly understand your question. What do you mean by information? Is it a file, a page, an abstract piece of data? What do you mean by client? Is it a browser, a computer identified by an IP, a registered customer?

The case of the registered customer is the easiest one. When downloading a file or loading a page or whatsoever, you can save a record in a table, saying that the customer A have requested the piece of data B. There are some nuances, especially with files download, but I'll not bother you with the details, especially since it's off-topic and would be more appropriate on StackOverflow.

If on the other hand you want to track downloads from the same machine, you can do it by identifying it through the IP address. This has some difficulties too: the same person using the same device can change IP even during the same session, or multiple devices can share the same IP address (like two computers of the same company connected through the same router).

Finally, you can track the client through the cookies. This has two weaknesses: the person can at any moment delete or change the cookie (and somebody else can use the same cookie), and if the person changes the browser, cookies will be lost.

Depending on your precise problem, you can choose one, two or all three types of tracking to be able to know more or less who downloaded what.

share|improve this answer
    
Hi, I am interested in the client-server communication in particular I need to provide a service that returns data only once for a client. –  A.DIMO Jun 23 '11 at 8:20

If you keep track of every change to the data, you can use a checksum (like SHA-1 in Git or MD5 in rsync) to quickly determine where to start the next download from. If you don't keep track of atomic changes, you can instead ask when the last download happened. The best practice here is simply to

  • request the smallest piece of information possible to identify what has been downloaded, and
  • respect privacy. Authentication should happen elsewhere, if necessary.
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.