• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFSocket event handler accessing GUI variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >CFSocket event handler accessing GUI variables (From: Matt Wilks <email@hidden>)

  • Prev by Date: Re: Loading images from subfolder of Resources
  • Next by Date: Re: Loading images from subfolder of Resources
  • Previous by thread: CFSocket event handler accessing GUI variables
  • Next by thread: Array to array based on values in it
  • Index(es):
    • Date
    • Thread