Re: network programming
Re: network programming
- Subject: Re: network programming
- From: Jens Alfke <email@hidden>
- Date: Sun, 02 Dec 2012 12:30:15 -0800
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-depth discussion of networking is best done on the macnetworkprog list on this server, btw. The Apple gurus like Quinn hang out there and are very helpful.
—Jens
_______________________________________________
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