So I have a loop waiting for a chat message:
<?php
while(TRUE) {
$packet = fread($socketIn, 1024);
if(rtrim(substr($packet, 0, 4)) == "MSO") {
$in = substr($packet, 4, 128);
$out = trim($in, "\0");
die($out);
}
usleep(100);
}
?>
This works okay. But of course it will only show one message and then end the script. How do you keep it running? I've had a look around and tried print() (because echo() is not actually a function

), but it seems that without having die() there it never displays the message. I can't see why. I guess this should be going on a PHP forum really
