thanks everybody, i've got this to work. i'm not trying to write an actual web server, i'm just using it for some procedures like URL rewriting.