Re: netstat launched from within Cocoa?
Re: netstat launched from within Cocoa?
- Subject: Re: netstat launched from within Cocoa?
- From: Mark Dalrymple <email@hidden>
- Date: Wed, 23 Apr 2003 14:47:09 -0400
Hi Lorenzo,
> NSArray *arguments = [NSArray arrayWithObjects:@"-f", @"inet",
@"-n",
> @"| grep '169.254.180.151'",
> @"| grep ESTABLISHED",
> @"awk '{ print $5 }'", nil];
That won't work, since the subsequent greps need to be their own
NSTasks and you'll need to manually connect the pipes.
Or, you can do the equivalent of
sh -c "netstat -f inet -n | grep '169.254.180.151' | grep ESTABLISHED |
awk '{
print $5 }'"
That is, start up a shell, and let the shell construct the pipeline and
execute it for you.
so, you'd use 'sh' as your task, and arguments something like this:
NSArray *arguments = [NSArray arrayWithObjects: @"-c", @"netstat -f
.... }'", nil];
Cheers,
++Mark Dalrymple, email@hidden
http://borkware.com
_______________________________________________
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.