With the latest cvs, if you turn on chargen (port 19 tcp) and run this:

<?
    $sock1 = socket_create (AF_INET, SOCK_STREAM, 0);
    if($sock1 < 0) die(socket_strerror($sock1));

    $res1 = socket_connect($sock1, '127.0.0.1', 19);
    if($res1 < 0) die(socket_strerror($sock1));

    $sock2 = socket_create (AF_INET, SOCK_STREAM, 0);
    if($sock2 < 0) die(socket_strerror($sock1));

    $res2 = socket_connect($sock2, '127.0.0.1', 19);
    if($res2 < 0) die(socket_strerror($sock1));

    $read = array($sock1,$sock2);
    while($num=socket_select($read, $write=NULL, $except=NULL, NULL)) {
        for($i=0; $i<$num; $i++) {
            $msg = socket_read($read[$i],1024);
            echo "[$i] ".strlen($msg)."\n";
        }
    }
?>

I am seeing that every now and then when I run it the output is:

[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024
[0] 1024

Sometimes it does work properly and it hops back and forth between the two
spewing sockets:

[0] 1024
[1] 1024
[0] 1024
[1] 1024
[0] 1024
[1] 1024
[0] 1024
[1] 1024
[0] 1024
[1] 1024
[0] 1024
[1] 1024
[0] 1024
[1] 1024
[0] 1024
[1] 1024

I would expect to always see it alternate between the two like this.  Can
anybody reproduce/explain this?

-Rasmus


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to