Monitoring a port on web server
Posted: Wed Feb 23, 2011 4:03 am
Hi
I need to continuously monitor a port (nominated in the range 7000-8999) on a web server using PHP and capture the traffic on the port to a MySQL database. It's the capture part that's proving frustrating...
The incoming data on that port can come from several IP addresses but is always sent to the same port on the server. The data messages are discrete, between 60 and 1999 bytes in length and are ASCII. They come between 2 and 30 secs apart. So far I've successfully managed to connect to one of the remote machines via fsockopen and tried various ways of fetching it directly without much success.
I really need to just monitor the port on the server itself though without connecting to a remote host (since I don't necessarily know what IP the messages are originating from) but I'm not sure that is possible unless socket_create is the way to go? Eventually, I also need to send a coded Ack to each message once validated as they are resent if not Acked so missing one is not a major problem.
Thanks in advance for any code or helpful suggestions.
TCN
I need to continuously monitor a port (nominated in the range 7000-8999) on a web server using PHP and capture the traffic on the port to a MySQL database. It's the capture part that's proving frustrating...
The incoming data on that port can come from several IP addresses but is always sent to the same port on the server. The data messages are discrete, between 60 and 1999 bytes in length and are ASCII. They come between 2 and 30 secs apart. So far I've successfully managed to connect to one of the remote machines via fsockopen and tried various ways of fetching it directly without much success.
I really need to just monitor the port on the server itself though without connecting to a remote host (since I don't necessarily know what IP the messages are originating from) but I'm not sure that is possible unless socket_create is the way to go? Eventually, I also need to send a coded Ack to each message once validated as they are resent if not Acked so missing one is not a major problem.
Thanks in advance for any code or helpful suggestions.
TCN