Re: CFSocket questions
Re: CFSocket questions
- Subject: Re: CFSocket questions
- From: Edward Fink <email@hidden>
- Date: Sat, 7 Sep 2002 00:19:18 -0400
The function(whatToDo) which gets executed when data arrives on the
socket....can this also be a method within a class? If so...what would
that look like. The reason I ask this is because I am having a problem
conceptually figuring out how I would actually be able to make more
than one connection via CFSocket if each different socket is going to
reference the same function. So if I had a function which was
responsible for creating and connecting a CFSocket and the function
"whatToDo" which handled the callbacks....how would I differentiate the
data arriving? Meaning if I had 3 sockets connected to 3 different
servers....and all their data is getting handled by function
"whatToDo"...how am I to know what data has just arrived from which
server? Will I need to create an array holding all my sockets so I
know which server, etc?
Anyways, hopefully I wasn't to confusing in my description but
basically I would like to be able to have a class which creates,
connects and handles incoming data from my socket. Then I could just
instantiate the class to have different sockets being handled
separately. However, if the callback cannot reference a class method
instead of a regular function I am not sure how I would go about this?
On Friday, September 6, 2002, at 01:06 PM, Douglas Davidson wrote:
am using code like the following which adds the Data callback:
CFSocketRef s = CFSocketCreate(NULL, PF_INET, SOCK_STREAM,
IPPROTO_TCP,
kCFSocketDataCallBack, whatToDo, NULL);
Just make that fifth argument (kCFSocketDataCallBack |
kCFSocketConnectCallBack).
_______________________________________________
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.