• 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: netstat launched from within Cocoa?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: netstat launched from within Cocoa? (From: Mark Dalrymple <email@hidden>)

  • Prev by Date: Re: Can a ScreenSaverView quit itself?
  • Next by Date: RE: Can a ScreenSaverView quit itself?
  • Previous by thread: Re: netstat launched from within Cocoa?
  • Next by thread: NSData array?
  • Index(es):
    • Date
    • Thread