Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
nickelcitymario
· 5y ago · 0 comments
Really enjoyed this, but I'm surprised by this line of code:
loop do client = server.accept
An infinite loop to listen for incoming requests? Is that really the right way to do this? Wouldn't this cripple your server eventually?
Comments
[–]
randomdata
5y ago
Presumably accept blocks, so your application would effectively pause at that point until a request needs to be handled. The loop brings the application back to waiting once the previous request is handled.
[–]
nickelcitymario
OP
5y ago
Ahhhh, that makes sense. Knew I had to be missing something. Thanks!