I have a datastream that sends me data with an ever-increasing index (n++). It is possible for some of that data to be sent out of order, lost or otherwise need to be retransmitted.
Example
Assume I have a security log file that is monitored by my app. It is possible for a bad guy to suppress or prevent transmission of a few entries. I want to be alerted to this fact.
Also assume that this data may be sent to the log recorder out of order.
It seems this logic is everywhere I don't want to reinvent the wheel and do something less than efficient.
Question
How should I implement (or what reference implementation exists) that allows me to track data received out of order and may contain missing data in a sequence?
(Also your assistance in tagging this question is appreciated)