3 ms·
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 re
by nickelcitymario 6y ago
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?
- randomdata 6y agoPresumably 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 6y agoAhhhh, that makes sense. Knew I had to be missing something. Thanks!