main s = makeServerSocket assert(S != -1) loop cout Waiting fd = accept ... assert( ....) null term cout Got one buf check for GET string req = buf; open da file if success write some meta if filename ends in jpg type = 'image/jpeg' if filename ends in html type = 'text/html' if filename ends in txt type = 'text/plain' write blank write file close da file if failure write(fd, "HTTP/1.0 404 YOu suck\r\n\r\nYou suck", 23)' close(fd);