MacOSX Socket Programming without run loop
Currently there is a CSNetwork class and a stream class with a run loop to recieve. Due to some reason I do not wish to have callbacks in my socket class code. I am looking for the following - simple connect API - simple send API - simple rec开发者_开发百科v API - simple getHostbyName equivalent without a callback
Can someone help
In short, don't do that unless you really need the code to be portable. If you do, then use the pure POSIX APIs, of which there are about a zillion examples and sites available for reference.
You'll be far better off sticking with the higher level, callback based, APIs using run loops and/or queues. Less code. Easier to maintain. More efficient (in that it is better integrated with the platform).
If you still think you need to go the route of no callbacks, explain why. Keep in mind that synchronous code is just asynchronous code that blocks waiting for a callback....
精彩评论