Re: Looking for CFSocket UPD setup and data-xfer samples/tutorials
Re: Looking for CFSocket UPD setup and data-xfer samples/tutorials
- Subject: Re: Looking for CFSocket UPD setup and data-xfer samples/tutorials
- From: "Michael A. Crawford" <email@hidden>
- Date: Mon, 23 Feb 2009 10:39:04 -0800
I think the important thing here is that CFSocket plays well with
RunLoop based GUI applications. Sure, I can create a thread and use
that to service the incoming UDP packets, but managing that thread
myself ultimately proves to be more complicated (an assumption) than
using CFSocket. That is why CFSocket exists, right?
By the way I did get my app working with a UDP CFSocket. Unless there
is some yet to be discovered performance issue with CFSocket, I see no
reason to switch to dedicated threads and blocking socket calls.
-Michael
----------------------
The difference between genius and stupidity...
...is that genius has its limits."
-- Albert Einstein
On Feb 17, 2009, at 4:19 PM, Josh Graessley wrote:
On Feb 17, 2009, at 4:04 PM, Michael A. Crawford wrote:
Thanks for the reply, Quinn. I'm surprised at how few examples
there are for this sort of code. Loads of TCP examples though. In
that arena, everyone seems to be re-using Apple's TCPServer class.
I've actually seen the code you pointed me to before. My problems
is in successfully transmitting a UDP packet, not receiving. Seems
like it would be quite simple but it doesn't work. I've written a
simple test app using old Berkeley style sockets with blocking
calls, which works just fine. Next, I'm going to re-write said
program to use CFSocket and CFRunLoop. I'm hoping that If I can
get it working, with those new Apple API calls, I can figure out
what I did wrong in my application, which isn't working.
CFSocket is handy for knowing when an event occurs on a socket. For
UDP sockets, the only interesting event is in the receive side
indicating there is data to be read. For writing to a UDP socket,
there is no buffering or flow control. The file descriptor will
always be ready to write.
-josh
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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