Hello i am trying to write a php script to monitor some tcp services running on our network. I use this code to get all the data off the port in one block.
the code is roughly like this
connect
read all data off port
send a command
read all data off port
close
my problem is that feof($sock) once it evaluates to true (once it is done reading all the data the first time) that when new data arrives (after the send) feof($sock) is still true signifing no more data.
also has any one found that the socket functions are buggy on windows? if i have set_socket_blocking on and have not written to the port yet feof($sock) never finds the end of the data(is this suppose to be this way?). problem goes awway with socket blocking off or if i have sent something to the port. just rather odd.
Karl Pietri
Code:
while(!feof($sock)){
$indata.=fgets($sock,256);
}
connect
read all data off port
send a command
read all data off port
close
my problem is that feof($sock) once it evaluates to true (once it is done reading all the data the first time) that when new data arrives (after the send) feof($sock) is still true signifing no more data.
also has any one found that the socket functions are buggy on windows? if i have set_socket_blocking on and have not written to the port yet feof($sock) never finds the end of the data(is this suppose to be this way?). problem goes awway with socket blocking off or if i have sent something to the port. just rather odd.
Karl Pietri