News for hackers. Stuff that matters.
Re:Nweb: a tiny, safe web server (static pages only) by stefs on Tuesday April 01, 2014 @04:48AM (#7506888)
> if LINUX sleep for one second to ensure the data arrives at the browser

can someone explain that please?

Re:Nweb: a tiny, safe web server (static pages only) by Pitarou on Tuesday April 01, 2014 @06:05AM (#7507140)
It's explained further down:

After the last byte of the file is sent, the nweb web server web() function stops for one second. This is to enable the file contents to be sent down the socket. If it immediately closes the socket, some operating systems do not wait for the socket to finish sending the data but drops the connection very abruptly. This would mean that some of the file content would not get to the browser, and this confuses the browser by waiting forever for the last bit of the file and often results in a blank web page being displayed.

Re:Nweb: a tiny, safe web server (static pages only) by kragen on Wednesday April 02, 2014 @01:26PM (#7517229)
This text has an error rate of about one factual error per sentence, as you'd expect from someone who capitalizes "Linux" as if it were an acronym.
Re:Nweb: a tiny, safe web server (static pages only) by Pitarou on Sunday April 06, 2014 @10:41AM (#7541087)
We're definitely in "works on my machine" territory here.

Still it's good for building your confidence as a programmer, no?

Re:Nweb: a tiny, safe web server (static pages only) by stefs on Tuesday April 01, 2014 @06:45AM (#7507219)
ah, sorry - i just read a part and ctrl+f'd for this, but searched for the wrong terms apparently.

would this cause connection timeouts if copying data to the socket took longer than one second? i'm always a bit sceptical when i encounter such seemingly arbitrary timing assumptions.