Socket

Hello,

Below is the code for socket server in PHP



    while(true)
    {
       $socketInput=socket_read($comSocket, 1024);
       
       $socketOutput = strtoupper($socketInput);
       
       socket_write($comSocket,$socketOutput);
       echo "
";
       
       sleep(1);
    }



in flash,

sock = new XMLSocket();
sock.connect(“127.0.0.1”, 9999);
//sock.send(“hello \0”);

while(1)
{
sock.send(“hello \0”);
}

sock.onData = function(data) {
trace(data);
}

sock.onClose = function() {
trace(“ended”);
}

When i connect i should keep on getting “HELLO”. But, the above code is not working. Flash stops because of while loop. Can someone tell me the correct way of writting? When i removed the while loop, i was getting only one “HELLO”

Thanks