Re: netstat launched from within Cocoa?
Re: netstat launched from within Cocoa?
- Subject: Re: netstat launched from within Cocoa?
- From: Charles Srstka <email@hidden>
- Date: Wed, 23 Apr 2003 16:26:49 -0500
Or you could put the output from netstat into an NSString and then use
NSString's search methods to find the data you want.
Charles
On Wednesday, April 23, 2003, at 01:47 PM, Mark Dalrymple wrote:
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.
_______________________________________________
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.