4 $FILE_SOCKET = "/tmp/test001.sock";
5 $UNIX_SOCKET = "unix://$FILE_SOCKET";
6 if (file_exists($FILE_SOCKET)) {
10 $old_umask = umask(0);
11 if (($list = stream_socket_server($UNIX_SOCKET, $err, $errs)) === FALSE) {
16 $new_socket = stream_socket_accept($list);
20 $fp = ancillary_getstream($new_socket, $stream_info);
21 printf("FP: %d\n", $fp);
23 stream_set_blocking ($fp, FALSE);
30 $from = fread($fp, 4096);
31 printf("FROM: [%s]\n", $from);
33 $body = "<html><title>Ancillary Test 001</title><body>HERE I AM</body></html>\n";
35 fwrite($fp, "HTTP/1.0 200 OK\r\n");
36 fwrite($fp, "Content-type: text/html\r\n");
37 fwrite($fp, "X-Savannah: rapatal\r\n");
38 // fwrite($fp, sprintf("Content-length: %d\r\n", strlen($body)));
46 print_r($stream_info);