Re: CFSocket questions
Re: CFSocket questions
- Subject: Re: CFSocket questions
- From: Becky Willrich <email@hidden>
- Date: Fri, 6 Sep 2002 09:53:35 -0700
1.) I have read that if I use CFSocketConnectToAddress with a timeout
of -1 it will connect in the background. And...If it connects in the
background I can add the callback "kCFSocketConnectCallBack" to my
already existing callback of "kCFSocketDataCallBack". Is this
correct? And if so how is this accomplished?
am using code like the following which adds the Data callback:
CFSocketRef s = CFSocketCreate(NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP,
kCFSocketDataCallBack, whatToDo, NULL);
How do I add the second callback???
CFSocketRef s = CFSocketCreate(NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP,
kCFSocketDataCallBack |
kCFSocketConnectCallBack, whatToDo, NULL);
2.) Can I reference the native socket directly while using CFSocket?
So for example using the native socket's send(). If so how do I go
about this and is there any benefit/downside to doing this?
Yes; if you don't already have the native socket, you can get it from
CFSocket via CFSocketGetNative(). I don't know of any win in calling
send() directly as opposed to calling CFSocketSendData(), though. But
I don't think it does any harm, either. Note that if you will be
sending large amounts of data (enough that you might block), you will
want to register for the kCFSocketWriteCallBack as well, so you don't
block in send() (or CFSocketSendData()).
REW
_______________________________________________
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.