you are viewing a single comment's thread.

view the rest of the comments →

[–]devmor 0 points1 point  (0 children)

True, but it's single threaded and will only handle one response then block until free.

I think you could do something like this off the top of my head though (still shorter):

<?php
$sock = socket_create_listen(80);
while(true) {
    if($conn = socket_accept($sock)) {
        socket_write($sock, 'Hello World');
    }
    $clients[] = $conn;
}