On 2 Dec 2012, at 20:30, Jens Alfke <j...@mooseyard.com> wrote:

> 
> On Dec 2, 2012, at 11:29 AM, hmier...@me.com wrote:
> 
>> question is, what's the best way to do that? can i use cocoa or do i have to 
>> use some lower-level libraries? i think the broker accepts TCP while 
>> flightgear expects UDP, AFAIK.
> 
> Cocoa has some limited support for TCP: you can open a client connection and 
> send and receive data. For anything beyond that you have to drop down to 
> CFNetwork. Doing a TCP server isn’t too hard because CFStream is toll-free 
> bridged to NSStream, so you can use CFStream to listen for connections and 
> then use NSStream for the I/O. Apple has some sample apps that demonstrate 
> this.
> 
> There’s no Cocoa support for UDP; the highest level system API for it is 
> CFSocket, or of course you could just use the POSIX system calls. It’s 
> possible there are 3rd party Obj-C APIs for UDP networking, but I don’t know 
> of any offhand.
In addition to TCP the AsyncSocket project also provides UDP support.
See AsyncUdpSocket and GCDAsyncUdpSocket in 
https://github.com/robbiehanson/CocoaAsyncSocket

Regards

Jonathan 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to