To make things easier, better to use combinations of NSStream and CFSocket and its related family.
Check "CocoaEcho" sample code in Apple's developer website.
I've been there with BSD socket, and it's a pain to do asynchronous behavior.
For UDP, you might just have to modify the socket type somewhere, or you could create an Objective-C wrapper out of BSD socket, and integrate with the existing TCP solution.
The WiTap on iPhone is also an example.
__________________
Visit Me
Writing code is not only about writing instructions to a machine / computer, but also about writing something that could be read, understood, and maintained by others. That's why, I like Cocoa.
|