Re: Triangulating webcams
Re: Triangulating webcams
- Subject: Re: Triangulating webcams
- From: Jens Alfke <email@hidden>
- Date: Sat, 12 Jul 2008 21:58:20 -0700
On 12 Jul '08, at 6:40 PM, em wrote:
I can easily transport 'strings' over a network using UDP multi-
casting/broadcasting via Quartz Composer, but some of these
strings may get a little lengthy. What's a good language
statement(s) (obj c API) for transporting small (10MB) data
structures over a network?
UDP's not well suited to that. The maximum size of a packet is
64kbytes, and in practice, packets larger than a few kbytes often get
lost due to fragmentation. Best practice with UDP is to keep the
packet size under about 1400 bytes so it fits in a single Ethernet
packet, and to be ready to handle packets that are dropped, or arrive
multiple times or in the wrong order.
So you're better off using TCP. Leave a connection open between the
machines and send messages over it (in either direction) when you have
data. But you need a framing protocol to define the boundaries of
messages, match messages with responses, let you interleave messages,
and so on. Nowadays most people do this with HTTP, but that's an
asymmetric protocol and CF/Cocoa don't come with a server-side
implementation, only a client. Other options are to invent yet another
protocol to do this (which can become a mess) or use a generic message
protocol like BEEP.
In my case I went with BEEP, but there is no available Obj-C API for
it [though Xgrid has its own private implementation], and the open-
source C library I first used became more trouble than it was worth,
so I ended up designing and implementing a simple BEEP-like protocol
called BLIP <http://projects.mooseyard.com/wiki/1/BLIP>. It has a
simple Objective-C API that lets you send messages from one machine to
another, and optionally send replies. It should work well for what
you're trying to do.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden