Would it help to read some of the Internet RFCs?  They deal with this
kind of things in various ways.

Not that they're concerned with Objective-C or Cocoa but the concepts
might be useful.

On 6/8/15, Graham Cox <[email protected]> wrote:
> I have the following task I need to implement.
>
>
> 1. I have a queue of NSData objects, usually representing a continuous
> stream, but delivered in variable-sized chunks. However some chunks could be
> missing, but the queue represents the correct order of the stream that was
> delivered, and the missing chunks can be flagged.
>
> 2. The data in the stream consists of packets of fixed length. I need to
> extract the packets and pass them as complete single entities to another
> object (a delegate) for further processing. All complete packets must be
> extractable, and I’d like to do this on a secondary thread if possible.
>
> 3. Due to the possibility of missing data chunks, resynchronisation for each
> new data may be required. I can detect when a data entry is contiguous with
> the previous one, or when one or more chunks has been skipped. A packet may
> be split across input data, or may be incomplete due to being split across
> data where the second part was missing.
>
> 4. Packet detection is based on a signature byte at the start of each
> packet, and the fixed length of the packet which is a few hundred bytes. If
> five consecutive packets are detected having the same signature byte, the
> packets are presumed to have been detected and can be extracted for
> processing.
>
> The object that handles this should accept NSData chunks as input and queue
> them, or if there is a missing chunk, a nil data object. The object’s
> delegate should be passed the extracted packets one at a time in order as
> they become available, again as NSData objects. No time synchronization
> between the input and output is required.
>
> This sort of processing isn’t really my strong point, so while I can think
> of various ways to solve it by brute force and ignorance, I would have
> thought this is something that would be recognisable as a standard sort of
> stream processing algorithm by those who’ve done it before. Even just an
> outline or pointer to something like this would be a help.
>
>
> —Graham
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to [email protected]


-- 
Michael David Crawford, Consulting Software Engineer
[email protected]
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to