Re: CFSocket event handler accessing GUI variables
Re: CFSocket event handler accessing GUI variables
- Subject: Re: CFSocket event handler accessing GUI variables
- From: Frederick Cheung <email@hidden>
- Date: Fri, 21 Jan 2005 17:23:18 +0000
On 21 Jan 2005, at 16:48, Matt Wilks wrote:
Hey,
I am using a CFSocket to monitor a BSD socket connection for incoming
data; defined like so:
msock = CFSocketCreateWithNative(kCFAllocatorDefault, raw_socket,
kCFSocketReadCallBack, &handleData, context);
The function handleData is defined as laid out in the API:
void handleData(CFSocketRef s, CFSocketCallBackType type,
CFDataRef address, const void *data, void *info)
I would like to be able to access the variables that control my GUI
from
this functions (perhaps to change some state variable based on the
input
from the socket). However this function doesn't seem to be an instance
or class method, so I don't have a hook into the variables defined in
the scope of the calling class. Is there some way around this that I
have missed?
The context parameter you pass to CFSocketCreateWithNative allows you
to specify what the info parameter you callback is called with, so you
just need to specify the instance of the class you want it to be able
to access as that info parameter.
Fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden