README added with the todolist to be consistent
[php-ancillary.git] / test001.php
1 #!/usr/bin/php
2 <?php
3
4 $FILE_SOCKET = "/tmp/test001.sock";
5 $UNIX_SOCKET = "unix://$FILE_SOCKET";
6 if (file_exists($FILE_SOCKET)) {
7     unlink($FILE_SOCKET);
8 }
9
10 $old_umask = umask(0);
11 if (($list = stream_socket_server($UNIX_SOCKET, $err, $errs)) === FALSE) {
12     exit(11);
13 }
14 umask($old_umask);
15
16 $new_socket = stream_socket_accept($list);
17
18 $fp = ancillary_getstream($new_socket);
19 printf("FP: %d\n", $fp);
20
21
22 if ($fp == FALSE)
23     printf("ERROR\n");
24 else
25     printf("GOOD\n");
26
27 fwrite($fp, "DI QUI CI PASSO2");
28 fflush($fp);
29 fclose($fp);
30
31 ?>