• 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
Notification System Woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Notification System Woes


  • Subject: Notification System Woes
  • From: Saul Iversen <email@hidden>
  • Date: Wed, 3 Dec 2003 00:15:33 -0500

I've been experimenting with the notification system over the past
month with some mixed success. The task launching code below is
contained in my controller and represents a portion of what I've
learned from a variety of sources (including the Moriarity example and
some of your gracious collective help). Although I am able to capture
and display the data that I expect to see from my subordinate
"temperature" process, it seems that I cannot get a notification any
sooner than after a full 500 bytes have been printed to stdout. So I
effectively receive a "large chunk" of data to be processed by my
gotData: method (large relative to each individual temperature reading
which is merely four characters and a carriage return in length).

Needless to say, I'd rather be receiving notifications much more
frequently so that I could keep refreshing the temperature display in
real time. My question then is how can I work around this issue? Can I
somehow set a smaller "buffer full" size so that the notification comes
after just a few bytes? Or should I be using an entirely different
approach? Your patience and support are sincerely appreciated.

Regards,
Saul

- (IBAction)startTemperatureProcess:(id)sender
{
NSString *path=@"/Users/Me/MyPath/Temperature";
fromPipe = [NSPipe pipe];
fromTemperature = [fromPipe fileHandleForReading];
temperature = [ [NSTask alloc] init];
[temperature setLaunchPath:path];
[temperature setStandardOutput:fromPipe];
[temperature setStandardError:fromPipe];

[ [NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(gotData:)
name:NSFileHandleReadCompletionNotification
object:fromTemperature];

[fromTemperature readInBackgroundAndNotify];
[temperature launch];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Notification System Woes
      • From: Ed Watkeys <email@hidden>
  • Prev by Date: Re: Load Object without actions.
  • Next by Date: NSMutableString Exemplars
  • Previous by thread: contract for mutableArrayValueForKey: ?
  • Next by thread: Re: Notification System Woes
  • Index(es):
    • Date
    • Thread