Re: kCFSocketWriteCallBack
Re: kCFSocketWriteCallBack
- Subject: Re: kCFSocketWriteCallBack
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Mon, 18 Aug 2014 09:44:17 +0100
On 16 Aug 2014, at 00:59, Jeremy Thompson <email@hidden> wrote:
> I need to be able to get away from CFSocketSendData as it does seem to block, taking too much time.
CFSocketSendData is a fairly thin wrapper around <x-man-page://2/send> (<x-man-page://2/sendto> if you include an address). It only blocks if the underlying socket is in blocking mode. In general, if you're using CFSocket in async mode, you want the socket to be non-blocking. Do this with F_SETFL as described in <x-man-page://2/fcntl>.
Notwithstanding the above, in my experience the various CFSocket wrappers, like CFSocketSendData, are more trouble that they're worth. When I'm using CFSocket I typically use it /just/ for run loop integration and do all my socket operations using BSD Sockets APIs (which have well-defined, if ugly, semantics).
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden