I was trying to create a socket on win 2000(fsockopen) and use the socket_set_blocking to false (non blocking so that my fgets won't stuck). After using the the above function the socket doesn't function as planed. After research i found out that php has a bug with winsock. I searched and found the replacement code for this specific bug but now i must recompile php on WIN 2000 PRO.
How can i do that? Or is there some other function to read from the socket besides fgets and behave like it in a way that it won't hung if there is no data in the socket?
here's my code:
$fp = fsockopen($host,$port,$errno,$errstr);
if (!$fp)
echo "EROARE: $errno - $errstr<br>\n";
while (!feof($fp))
{
// ce a venit in socket???
$gigi = fgets($fp,4096);
$parsed = explode(" ",$gigi);
if ($parsed[1]=="some event")
fputs($fp,"other event");
}
Please help....