$sock = stream_socket_server("tcp://0.0.0.0:8000");
while ($cli = stream_socket_accept($sock, -1, $peer)) {
echo 'start'."\r\n";
$ClientData = '';
$AESKey = null;
while (!feof($cli))
{
if(is_null($AESKey))
{
$AESKey = fread($cli, 512);
}else{
$ClientData .= fread($cli, 512);
}
echo "read\r\n";
}
fclose($cli);
}