Re: network programming
Re: network programming
On 2 Dec 2012, at 20:30, Jens Alfke <email@hidden> wrote:
>
> On Dec 2, 2012, at 11:29 AM, email@hidden 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 (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