Hey all,
I have a script that sends a simple message on a socket, and then awaits a reply. As it is waiting reply, it is echoing some simple graphics to let the user know something is still happening. The message sent, or even the one received is not important-- however my code always freezes before the loop can take effect. Something in socket_recvfrom is not letting it continue listening on the first try. My code is posted below.
$out=" ";
$count=0;
$port_test=NULL;
$from=NULL;
do {
$count=$count+1;
echo something to entertain user
flush();
ob_flush();
$test=socket_recvfrom($sock,$out, 1024, 2, $from, $port_test);
sleep(2);
if($out=="WAITDONE"){
$count=31;
}
}while($count < 30);
Is there some sort of setting for recv_from that will allow it to simply check, and then continue on. Right now the remote host has to send some garbage message to get things moving onto the next iteration.
Any help would be appreciated!