And now ladies and gentlemen, the smallest web server in the world!
248 bytes.
Will turn your computer in a http server.
You'd better have a firewall on your computer BTW...
The server's root is the program's directory, so if you don't save the code to a file and run it right from the standard IDE (from an untitled docuemnt), the root will be .../BlitzMax/tmp. Not many usefull docs to see there.
So save the program in a source file right at the root of your BlitzMax folder for example.
Run the program and point your browser to "http://localhost/doc/index.html"
Tada, the BlitzMax help page!
Provided your firewall doesn't filter connexions on port 80, you can check that a buddy can also access it via http://<yourip>/doc/index.html
That's right, you're running a 248 bytes long http server :p
m:TSocket=CreateTCPSocket()m.bind(80)m.listen(0)#D;Try;c:TSocket=SocketAccept(m,-1)s:TStream=CreateSocketStream(c)u$=ReadLine(s)[5..]ReadString s,c.ReadAvail()u=u[..u.FindLast(" ")]CopyStream(OpenFile(u),s)Catch o:Object;EndTry;CloseStream(s)Goto D
248 bytes.
Will turn your computer in a http server.
You'd better have a firewall on your computer BTW...
The server's root is the program's directory, so if you don't save the code to a file and run it right from the standard IDE (from an untitled docuemnt), the root will be .../BlitzMax/tmp. Not many usefull docs to see there.
So save the program in a source file right at the root of your BlitzMax folder for example.
Run the program and point your browser to "http://localhost/doc/index.html"
Tada, the BlitzMax help page!
Provided your firewall doesn't filter connexions on port 80, you can check that a buddy can also access it via http://<yourip>/doc/index.html
That's right, you're running a 248 bytes long http server :p