> At 09:59 AM 2/27/04 -0700, Wiggins d Anconia wrote:
> >It appears netstat just reads the values from /proc/net and prints them
> >in a nice way, so presumably you could use standard opens on the /proc
> >files and read specifically what you want rather than having netstat
> >parse them for you.  Though this might actually be one of the places
> >where shelling out makes sense.  CPAN didn't turn up much...
> >
> >http://search.cpan.org/~vsego/Linux-net-dev-1.00/dev.pm
> 
> Hey, don't forget the end users on windows.  At last count there were more
> than ... well lets see, one, two, three ... 
> 

If I only could forget them ;-)... I just choose to ignore them.
Honestly in this case netstat seemed so unix dependent (that it uses
/proc) I wasn't even aware (and didn't care to find out which is
probably where the fault is) if it existed for windows.


> OK, the real reason I had to chime in is that I posted a similar query a
> couple months ago, asking if there was Net::Netstat on CPAN and, if not,
> why not.  On the face of it, netstat would seem just the kind of thing
> you'd find on CPAN, along with interfaces to other network-related
features
> (HTTP, DNS, mail, FTP, news, sockets, and so on).  Your answer, Wiggins,
> may well get to the heart of it, which may be that the source of the data
> filtered by netstat is heavily system dependent and not amenable to a
> generalized solution, meaning that (again, guessing) any code would be a
> long chain of special cases.
>

I think you are right about the above, which makes it a perfect exercise
for a good design. File::Spec may be a good example, where there is a
base interface that is global, but loaded through subclassing.  Done
right it seems the special cases could be hidden well from the end user,
and then it would be up to finding maintainers (and more importantly
testers) for the various platforms, which should be doable.  My question
would be how frequently does this information change for a given
system... figure a linux kernel lasts for years, and I wouldn't expect
/proc to change greatly with the minor versions, seems once written it
would be a relatively small maintenance module (at least for the base
functionality).
 
> Like the original poster ([EMAIL PROTECTED]), I have an application
> which uses netstat and it pains me greatly to have to shell out to get
that
> information.  Not to mention the burden of dealing with path information,
> error-handling if for some reason the shell fails, etc etc, when you know
> for a fact that the network status information is definitely available if
> you just knew how to ask the system for it.  The netstat portion of my
> application is one of its most fragile parts.  
> 
> Does anyone know of another list specific to network programming where the
> question might be raised?
> 

Well theoretically lib-net but there is virtually no traffic there (or
my subscription doesn't work) and I got no response for a bug I posted
some while back.

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to