Checkout the following on a similar attempt by shotgunefx who appears to have run into the same wall you did and worked a solution which is talked about in Node 184721
There is also an discussion of using Regex with Netstat that contains some code examples at Node 172741
While not a module, from the quick read of these, they appear to contain enough code snippets to get you well started down the path. | [reply] |
Those information netstat printed out are actually accessiable through various c structures. What netstat does is simply present those info visually.
I am not aware of any Perl module wrap those c stuff.
Ib this case, you can simply get what you want thru open3 calls.
One thing important is to always do a waitpid after each open3 call, otherwise you will create lots of zombies. | [reply] |
Yeah, I don't think I'm going to find a wrapper either.
I could write a C program, I just prefer Perl DBI over the MySQL C API.
I might try doing something like this:
open(STATUS, "netstat -an 2>&1 |")
|| die "can't fork: $!";
...but, I have not decided yet.
Well, regardless, thank you both for your responses :-) | [reply] [d/l] |
Um, there is nothing comprehensive that I know about, but netstat does a lot of things. Is there something specific you are looking to do?
Update: I'm just curious why I'm getting negative votes for this? All I did was ask for clarification.
"Nothing is sure but death and taxes" I say combine the two and its death to all taxes! | [reply] [d/l] |
Yes, thanks for asking.
I'm trying to find the total number of inbound and outbound email connections on my server. I'm currently doing this by running 'ps' piped through sed and grep to trim out all 'smtp' and 'smtpd' entries.
I'm attempting to clean this up and move to Perl functions instead of using my current shell script and without using system/backtick commands in Perl. I'd also rather use a netstat type function as opposed to running 'ps'.
| [reply] |
| [reply] |