1--TEST--
2Support for paths in the abstract namespace (bind, connect)
3--SKIPIF--
4<?php
5if (!extension_loaded('sockets'))
6	die('skip sockets extension not available.');
7
8if (PHP_OS != 'Linux') {
9	die('skip For Linux only');
10}
11?>
12--FILE--
13<?php
14include __DIR__."/mcast_helpers.php.inc";
15
16$path = "\x00/foo_bar";
17
18echo "creating server socket\n";
19$servers = socket_create(AF_UNIX, SOCK_STREAM, 0) or die("err");
20socket_bind($servers, $path) or die("Could not bind");
21socket_listen($servers) or die("Could not listen");
22socket_set_nonblock($servers) or die("Could not put in non-blocking mode");
23
24echo "creating client socket\n";
25$clients = socket_create(AF_UNIX, SOCK_STREAM, 0) or die("err");
26socket_connect($clients, $path) or die("Error connecting");
27
28$conns = socket_accept($servers) or die("Could not accept connection");
29
30$r = socket_sendmsg($clients, [
31	//"name" => [ "addr" => $path, ],
32	"iov" => ["test ", "thing", "\n"],
33], 0);
34var_dump($r);
35checktimeout($conns, 500);
36
37if (!socket_recv($conns, $buf, 20, 0)) die("recv");
38print_r($buf);
39?>
40--EXPECTF--
41creating server socket
42creating client socket
43int(11)
44test thing
45