1--TEST--
2ext/sockets - socket_getpeername - 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    $s_c     = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
15    $s_bind  = socket_bind($s_c, '0.0.0.0');
16    var_dump($s_bind);
17
18    // Connect to destination address
19    $s_peer  = socket_getpeername($s_c, $ip, $port);
20    var_dump($s_peer);
21    var_dump($ip);
22    var_dump($port);
23    socket_close($s_c);
24?>
25--EXPECTF--
26bool(true)
27
28Warning: socket_getpeername(): unable to retrieve peer name [%i]: %a in %s on line %d
29bool(false)
30NULL
31NULL
32