CFSocket completeness
CFSocket completeness
- Subject: CFSocket completeness
- From: Eric Lengyel <email@hidden>
- Date: Fri, 13 Feb 2004 04:55:26 -0800
Hi --
I've been converting some old OpenTransport code to CFSocket lately
(for a multiplayer game), and it seems that there are a few things
missing. I wanted to run it by you guys to see if I was missing
anything. I have three issues:
1) CFSocket includes a function CFSocketSendData(), but does not
include a complementary CFSocketReceiveData() function. I've been able
to receive data on a run loop by listening for the
kCFSocketDataCallBack type, but this requires going through the run
loop once for every datagram received when UDP is being used. It'd be
nice to be able to listen for the kCFSocketReadCallBack type and then
repeatedly call a function like CFSocketReceiveData() to get all of the
available datagrams. In the case that I'm listening on the socket in a
separate thread, this would be more efficient because I wouldn't have
to release and re-acquire mutexes for every message. Can anybody give
me a more symmetric way of doing things here?
2) CFSocket doesn't provide any access to socket options, so I have to
get the native socket handle and call setsockopt(). Kinda goes against
the whole encapsulation thing, but not a big deal. Is there anything
better than this?
3) Another nit-picky issue about encapsulation: CFSocket doesn't
abstract addresses at all, and we're still stuck looking at the ugly
UNIX-style sockaddr and sockaddr_in structures. Am I wrong?
Thanks for any info you can provide.
-- Eric Lengyel
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.