I would like to know how to write code which would monitor the status of different ports on a single Unix Box.
Currently I have access to AIX Version 5 and Compaq Tru64 UNIX V5.1. I am desperately looking for some technical guidance as how to code for a port manager utility.
I would like to self develop code for monitoring the status of your ports ( listen , active or close etc modes). I agree that there are several tools available both on Unix OS and third party to provide these functionality but I feel as a core developer and Unix Lover there is something I should construct out of my own hands.
Well, the way things like "netstat" work are generally pretty
system-specific... So, the best way to figure out how to
develop an app that works like they do is to study the source
for your system's implementation of them... Assuming the
source is available, anyway... If you're using some sort of
proprietary Unix, then you may be out of luck... But, perhaps
using something like "strace"/"truss" on the binaries, might
at least provide you with some clue as to how to proceed...
(Or, if you can read assembly, disassemble it...) Or, if you
named your specific Unix system, maybe someone here might
already know the way to get at the sort of info you need...
Of course, if you're on an open source Unix system, you've
got it easy: just grab the source for "netstat" (or, whatever else
you care to behave like), and see how they work...
I would like to know how to write code which would monitor the status of different ports on a single Unix Box.
What do you mean by "monitor the status of different ports"?
If you mean you want to know if the ports are listening, are being used by active connections, or something like that, then you could use the netstat application inside your program periodically to check the status (man netstat will give you the information you need).
If you want to check the status of your ports and don't want to trust your system's tools, then you could use a port scanning tool (I prefer nmap).
If you want to monitor traffic then you could use any sniffer/packet dump utility to check the traffic in/out of your system.
Please explain
How much does getting a small tattoo on your hip/stomach hurt?
Do anyone else have an itchy anus? ?
|