1--TEST-- 2ext/sockets - socket_getsockname - basic test 3--CREDITS-- 4Florian Anderiasch 5fa@php.net 6--SKIPIF-- 7<?php 8 if (!extension_loaded('sockets')) { 9 die('skip sockets extension not available.'); 10 } 11?> 12--FILE-- 13<?php 14 $rand = rand(1,999); 15 $s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 16 $s_bind = socket_bind($s_c, '0.0.0.0', 31330+$rand); 17 var_dump($s_bind); 18 19 // Connect to destination address 20 $s_peer = socket_getpeername($s_c, $ip, $port); 21 var_dump($s_peer); 22 var_dump($ip); 23 var_dump($port); 24 socket_close($s_c); 25?> 26 27--EXPECTF-- 28bool(true) 29 30Warning: socket_getpeername(): unable to retrieve peer name [%i]: %a in %s on line %i 31bool(false) 32NULL 33NULL 34