File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
network /
fsockopen_variation2.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
testing fsockopen() with udp sockets
--FILE--
<?php
$hostname = 'udp://127.0.0.1';
$port = '31337';
echo "Open a server socket\n";
$server = stream_socket_server($hostname . ':' . $port, $errno, $errstr, STREAM_SERVER_BIND);
echo "\nCalling fsockopen():\n";
$client = fsockopen($hostname, $port);
var_dump($client);
echo "\nPass some data between the sockets:\n";
fwrite($client, "0123456789");
var_dump(fread($server, 10));
fclose($client);
echo "\nCalling fsockopen() with address and port in same string:\n";
$address = $hostname . ':' . $port;
$second_client = fsockopen($address);
var_dump($second_client);
echo "\nPass some data between the sockets:\n";
fwrite($second_client, "0123456789");
var_dump(fread($server, 10));
fclose($second_client);
echo "Done";
?>
--EXPECTF--
Open a server socket
Calling fsockopen():
resource(%d) of type (stream)
Pass some data between the sockets:
string(10) "0123456789"
Calling fsockopen() with address and port in same string:
resource(%d) of type (stream)
Pass some data between the sockets:
string(10) "0123456789"
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>