darkman0101
Technical User
I am trying to obtain the status (eg listening or established) for a tcp port. When a certain service starts it listens on port x. I want to monitor this port to know when a remote machine connects to it.
I can pipe 'netstat -a -n' to a disk file and read each line for this local port and read the status, but this will need to be done on a timer event (thereby using some cpu time) and will result on a disk read/write each time.
I want to avoid this if possible.
Is there something in the APIs that will do a netstat like function and allow me to watch this port. Or do I somehow need to attach a socket to this port and watch for data (I may be talking "out of my league" on this last idea as I know very little on networking)
Any help would be appreciated
Jas
I can pipe 'netstat -a -n' to a disk file and read each line for this local port and read the status, but this will need to be done on a timer event (thereby using some cpu time) and will result on a disk read/write each time.
I want to avoid this if possible.
Is there something in the APIs that will do a netstat like function and allow me to watch this port. Or do I somehow need to attach a socket to this port and watch for data (I may be talking "out of my league" on this last idea as I know very little on networking)
Any help would be appreciated
Jas