• 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: 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.

  • Follow-Ups:
    • Re: netstat launched from within Cocoa?
      • From: Charles Srstka <email@hidden>
References: 
 >Re: netstat launched from within Cocoa? (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: netstat launched from within Cocoa?
  • Next by Date: Re: write to the console
  • Previous by thread: Re: netstat launched from within Cocoa?
  • Next by thread: Re: netstat launched from within Cocoa?
  • Index(es):
    • Date
    • Thread