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_conn  = socket_getsockname($s_c, $ip, $port);
21    var_dump($s_conn);
22    var_dump($ip);
23    var_dump($port);
24    socket_close($s_c);
25?>
26
27--EXPECTF--
28bool(true)
29bool(true)
30string(7) "0.0.0.0"
31int(%i)
32
33