X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=php-ancillary.git;a=blobdiff_plain;f=test001.php;h=4a829b5ba1e239a70bda3b792dea837774fa499e;hp=fd2e1f429ae173d9d106b9792d27dfd47f7ae780;hb=HEAD;hpb=45f8c81a4c78d99b789561672ef2ebe70879bb09 diff --git a/test001.php b/test001.php index fd2e1f4..4a829b5 100755 --- a/test001.php +++ b/test001.php @@ -15,17 +15,33 @@ umask($old_umask); $new_socket = stream_socket_accept($list); -$fp = ancillary_getstream($new_socket); +$stream_info = ""; + +$fp = ancillary_getstream($new_socket, $stream_info); printf("FP: %d\n", $fp); +stream_set_blocking ($fp, FALSE); if ($fp == FALSE) printf("ERROR\n"); else printf("GOOD\n"); -fwrite($fp, "DI QUI CI PASSO2"); +$from = fread($fp, 4096); +printf("FROM: [%s]\n", $from); + +$body = "Ancillary Test 001HERE I AM\n"; + +fwrite($fp, "HTTP/1.0 200 OK\r\n"); +fwrite($fp, "Content-type: text/html\r\n"); +fwrite($fp, "X-Savannah: rapatal\r\n"); +// fwrite($fp, sprintf("Content-length: %d\r\n", strlen($body))); +fwrite($fp, "\r\n"); + +fwrite($fp, $body); + fflush($fp); fclose($fp); -?> \ No newline at end of file +print_r($stream_info); +?>