Annotation of embedaddon/php/ext/standard/tests/network/fsockopen_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: testing fsockopen() with udp sockets
! 3: --FILE--
! 4: <?php
! 5:
! 6: $hostname = 'udp://127.0.0.1';
! 7: $port = '31337';
! 8:
! 9: echo "Open a server socket\n";
! 10: $server = stream_socket_server($hostname . ':' . $port, $errno, $errstr, STREAM_SERVER_BIND);
! 11:
! 12: echo "\nCalling fsockopen():\n";
! 13: $client = fsockopen($hostname, $port);
! 14: var_dump($client);
! 15:
! 16: echo "\nPass some data between the sockets:\n";
! 17: fwrite($client, "0123456789");
! 18: var_dump(fread($server, 10));
! 19: fclose($client);
! 20:
! 21: echo "\nCalling fsockopen() with address and port in same string:\n";
! 22: $address = $hostname . ':' . $port;
! 23: $second_client = fsockopen($address);
! 24: var_dump($second_client);
! 25:
! 26: echo "\nPass some data between the sockets:\n";
! 27: fwrite($second_client, "0123456789");
! 28: var_dump(fread($server, 10));
! 29: fclose($second_client);
! 30:
! 31: echo "Done";
! 32:
! 33: ?>
! 34: --EXPECTF--
! 35: Open a server socket
! 36:
! 37: Calling fsockopen():
! 38: resource(%d) of type (stream)
! 39:
! 40: Pass some data between the sockets:
! 41: string(10) "0123456789"
! 42:
! 43: Calling fsockopen() with address and port in same string:
! 44: resource(%d) of type (stream)
! 45:
! 46: Pass some data between the sockets:
! 47: string(10) "0123456789"
! 48: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>