Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

socket programing

Status
Not open for further replies.

lordhuh

Programmer
Apr 25, 2000
96
US
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.
Code:
    	while(!feof($sock)){
    		$indata.=fgets($sock,256);
    	}
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top