Operating System - HP-UX
1833875 Members
3131 Online
110063 Solutions
New Discussion

Calculating network statistics using C

 
Hemant_7
Occasional Advisor

Calculating network statistics using C

Hi
I want to get network statistics same as we get through netstat -i command .

Actually i want to write a C funtion which give me all the details of interface connected such as Interface name Ipackets ,Opackets,Collision and errors
Is there any structure in HPUX that gives all this information ??. If it is how to get info from it ??

Could u please help me.
Thanking you in advance .

Warm regards
hemant
4 REPLIES 4
Shannon Petry
Honored Contributor

Re: Calculating network statistics using C

Start by reading the man page for lanadmin.

If you want more information than this(I.E. Packet sizes and protocals as well as bandwidth), I would recommend that you look at other software that's already working well.

ntop is already developed(not sure about a HP-UX port though), and there are many other packages as well. It's alot of work to re-invent the wheel.

Regards,
Shannon
Microsoft. When do you want a virus today?
Stanimir
Trusted Contributor

Re: Calculating network statistics using C

Hi!
Try this link, here is a lot of network
watching & tracing packages.

hpux.cs.utah.edu/hppd/hpux/Networking/Admin/alpha.html

Regards, S
Hemant_7
Occasional Advisor

Re: Calculating network statistics using C

Hi
Thanks for the info .But still not able to find the clue.

Does HPUX has any structure which give info about state of network interfaces such as name Ipacket Opacket collison and errors.if yes how can i use it.

Like using kmem and then use name list ie nlist()(_ifnet) to get all the information of network interface. Just an idea.

Please correct me if i m wrong.

Waiting for ur reply
Thanks and regards
hemant
Rajeev  Shukla
Honored Contributor

Re: Calculating network statistics using C

Hi hemant,
There are few libraries you might want to check out which gives you the best result.
getnetconfig this returns a structure called netconfig

and other one is getnetent.
go through the man pages of them i am sure getnetconfig() will give you everything you want.

Cheers
Rajeev