I'm experimenting with a very simple php server. It accepts one connection, reads what's sent, writes it and exits (I'm running it from the cli). The code is what follows. The problem is that whenever the length of the data exceeds 1024, it doesn't intercepts the end of data and so it just hangs. Any help? Thanks
$out= '';
while ($out = socket_read($client, 1024))
{
echo $out;
}
echo "ok";
socket_close($client);
socket_close($sock);
?>