Annotation of embedaddon/php/ext/standard/tests/network/fsockopen_variation1.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: testing fsockopen without a protocol string
                      3: --FILE--
                      4: <?php
                      5: 
                      6: echo "Open a server socket\n";
1.1.1.2 ! misho       7: for ($i=0; $i<100; $i++) {
        !             8:   $port = rand(10000, 65000);
        !             9:   /* Setup socket server */
        !            10:   $server = @stream_socket_server("tcp://127.0.0.1:$port");
        !            11:   if ($server) {
        !            12:     break;
        !            13:   }
        !            14: }
1.1       misho      15: 
                     16: echo "\nCalling fsockopen() without a protocol in the hostname string:\n";
                     17: $hostname = '127.0.0.1';
                     18: $client = fsockopen($hostname, $port);
                     19: var_dump($client);
                     20: fclose($client);
                     21: 
                     22: echo "\nCalling fsockopen() with address and port in same string, without a protocol:\n";
                     23: $address = $hostname . ':' . $port;
                     24: $second_client = fsockopen($address);
                     25: var_dump($second_client);
                     26: fclose($second_client);
                     27: 
                     28: echo "Done";
                     29: ?>
                     30: --EXPECTF--
                     31: Open a server socket
                     32: 
                     33: Calling fsockopen() without a protocol in the hostname string:
                     34: resource(%d) of type (stream)
                     35: 
                     36: Calling fsockopen() with address and port in same string, without a protocol:
                     37: resource(%d) of type (stream)
                     38: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>