9 "Server: Harvie's HTTPd\n".
10 "Connection: close\n\n";
14 Date: Thu, 05 Jul 2007 17:28:16 GMT
15 Server: Apache/2.0.59 (Win32) PHP/5.1.4
18 Content-Type: text/html;charset=utf-8
26 $socket = socket_create(AF_INET
, SOCK_STREAM
, 0) or die("Could not create socket\n");
27 $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
28 $result = socket_listen($socket, 3) or die("Could not set up socket listener\n");
30 // accept incoming connections
31 // spawn another socket to handle communication
32 $spawn = socket_accept($socket) or die("Could not accept incoming connection\n");
35 while($line = socket_read($spawn, 1024) && $loop) {
37 if(eregi("(GET|POST)", $line)) {
40 $line = explode(" ", $line);
41 readfile(".".$line[1]);
47 //$input = socket_read($spawn, 1024) or die("Could not read input\n");
48 // clean up input string
49 //$input = trim($input);
50 // reverse client input and send back
51 //$output = strrev($input) . "\n";
52 //socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n");
56 socket_close($socket);
This page took 1.837893 seconds and 4 git commands to generate.