Code to do what netstat -an does on an AIX box
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Code to do what netstat -an does on an AIX box




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Code to do what netstat -an does on an AIX box  
nsubrama@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-08-06 06:55 PM

Can anyone tell me how to write code that shows the active TCP
connections on an AIX box? In short I would like to do what netstat -an

does.

I did a truss on netstat and found out that it is really calling
netstat64 to do the main processing. I ran truss on netstat64 and found

out that it is calling getkerninfo, with the first argument being
passed in as KINFO_READ. Beyond this I am not able to figure out any
further. Any help would be most appreciated!


Regards


Narayan






[ Post a follow-up to this message ]



    Re: Code to do what netstat -an does on an AIX box  
James Carlson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

nsubrama@gmail.com writes:
> Can anyone tell me how to write code that shows the active TCP
> connections on an AIX box? In short I would like to do what netstat -an
>
> does.
>
> I did a truss on netstat and found out that it is really calling
> netstat64 to do the main processing. I ran truss on netstat64 and found
>
> out that it is calling getkerninfo, with the first argument being
> passed in as KINFO_READ. Beyond this I am not able to figure out any
> further. Any help would be most appreciated!

Your best bet is to use popen(3C) on the netstat command and parse the
output yourself.  If you're wandering into getkerninfo, I think you're
in a really rough neighborhood.  That gets into kernel implementation
details, and if you make your program dependent on the undocumented
parts of your OS kernel, then your program may fail unexpectedly the
next time the system is upgraded or patched.

--
James Carlson, KISS Network                    <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:21 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register