System Administration

C Program to Check Network Interfaces

 
Greg Wojtak_1
Occasional Contributor

C Program to Check Network Interfaces

I am writing a C program to get some various system information counters on HP-UX 11.11 and 11.23. I have gotten most of what I need from the pstat family of functions, but the one thing that I am unable to figure out is the ethernet card information. I want to be able to see the same type of information that is output in with a netstat -ai (collisions, in/out packets, and errors). I've searched the forums and from what I've seen, it sounds like HP is not documenting how to do this directly. Is this still the case? I've tusc'd a netstat -ai command and it looks /dev/dlpi is being opened and some STREAMs-based stuff is going on, ie putmsg() and getmsg(), along with a couple of ioctl()'s.

Is it possible to get this information directly rather than exec()'ing netstat?
3 REPLIES 3
Steve Steel
Honored Contributor

Re: C Program to Check Network Interfaces

Hi


never tried it but

http://hpux.connect.org.uk/

Search on network and see if you can find an example you can use


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Mark Greene_1
Honored Contributor

Re: C Program to Check Network Interfaces

Can you tell if netstat is using /usr/conf/h/io.h? Seems to be quite a few clues in there if it applies.

mark
the future will be a lot like now, only later
Carlos Roberto Schimidt
Regular Advisor

Re: C Program to Check Network Interfaces

Netstat dont show collision. USe lanadmin or landiag for this.

You can use snmp for acomplish this task.

See http://www.net-snmp.org for more information.

Using a mib browser is possible find wich attributes you need.

Schimidt