Non-blocking I/O allows you to poll multiple connections, and see if they have any data.

socket_select() example

$read = array ($sock1, $sock2);
$read_pool = $read;

socket_select ($read_pool, null, null, 0);
if (in_array ($sock1, $read_pool)) {
    print "Can read from sock1\n";
}