partial void startStopPing(Foundation.NSObject sender) { if (task != null) { task.Interrupt(); } else { task = new NSTask(); task.LaunchPath = "/sbin/ping"; string[] args = { "-c10", hostField.StringValue }; task.Arguments = args; // Create a new pipe pipe = new NSPipe(); task.StandardOutput = pipe; NSFileHandle fh = pipe.ReadHandle; NSNotificationCenter nc = NSNotificationCenter.DefaultCenter; nc.RemoveObserver(this); nc.AddObserver(this, new Selector("dataReady:"), NSFileHandle.ReadCompletionNotification, fh); nc.AddObserver(this, new Selector("taskTerminated:"), NSTask.NSTaskDidTerminateNotification, task); task.Launch(); outputView.Value = ""; // Suspect = Obj-C example is [fh readInBackgroundAndNotify] - no arguments fh.ReadInBackground(); } }