Avoid use of random ports in some socket tests

This commit is contained in:
Nikita Popov 2019-07-03 12:47:49 +02:00
parent a023eb3967
commit d6d9024cb8
6 changed files with 8 additions and 14 deletions

View file

@ -14,9 +14,8 @@ fa@php.net
?> ?>
--FILE-- --FILE--
<?php <?php
$rand = rand(1,999);
$s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$s_bind = socket_bind($s_c, '0.0.0.0', 31330+$rand); $s_bind = socket_bind($s_c, '0.0.0.0');
var_dump($s_bind); var_dump($s_bind);
// Connect to destination address // Connect to destination address

View file

@ -1,5 +1,5 @@
--TEST-- --TEST--
ext/sockets - socket_getsockname - basic test ext/sockets - socket_getpeername - basic test
--CREDITS-- --CREDITS--
Florian Anderiasch Florian Anderiasch
fa@php.net fa@php.net
@ -11,9 +11,8 @@ fa@php.net
?> ?>
--FILE-- --FILE--
<?php <?php
$rand = rand(1,999);
$s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$s_bind = socket_bind($s_c, '0.0.0.0', 31330+$rand); $s_bind = socket_bind($s_c, '0.0.0.0');
var_dump($s_bind); var_dump($s_bind);
// Connect to destination address // Connect to destination address

View file

@ -11,9 +11,8 @@ fa@php.net
?> ?>
--FILE-- --FILE--
<?php <?php
$rand = rand(1,999);
$s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$s_bind = socket_bind($s_c, '0.0.0.0', 31330+$rand); $s_bind = socket_bind($s_c, '0.0.0.0');
var_dump($s_bind); var_dump($s_bind);
// Connect to destination address // Connect to destination address

View file

@ -8,8 +8,7 @@ ext/sockets - socket_send - test with incorrect parameters
?> ?>
--FILE-- --FILE--
<?php <?php
$rand = rand(1,999); $s_c = socket_create_listen(0);
$s_c = socket_create_listen(31330+$rand);
$s_w = socket_send($s_c, "foo", -1, MSG_OOB); $s_w = socket_send($s_c, "foo", -1, MSG_OOB);
socket_close($s_c); socket_close($s_c);
?> ?>

View file

@ -8,8 +8,7 @@ ext/sockets - socket_sendto - test with incorrect parameters
?> ?>
--FILE-- --FILE--
<?php <?php
$rand = rand(1,999); $s_c = socket_create_listen(0);
$s_c = socket_create_listen(31330+$rand);
$s_w = socket_sendto($s_c, "foo", -1, MSG_OOB, '127.0.0.1'); $s_w = socket_sendto($s_c, "foo", -1, MSG_OOB, '127.0.0.1');
socket_close($s_c); socket_close($s_c);
?> ?>

View file

@ -11,11 +11,10 @@ fa@php.net
?> ?>
--FILE-- --FILE--
<?php <?php
$rand = rand(1,999); $s_c_l = socket_create_listen(0);
$s_c_l = socket_create_listen(31330+$rand);
socket_set_nonblock($s_c_l); socket_set_nonblock($s_c_l);
var_dump($s_c_l); var_dump($s_c_l);
#socket_accept($s_c_l); //socket_accept($s_c_l);
socket_close($s_c_l); socket_close($s_c_l);
?> ?>
--EXPECTF-- --EXPECTF--