Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Whenever I use concurrent clients to connect to a self-rolled server, I encounter strange "blocking" issues. Why?
Here is a test setup to demonstrate this:
test-server.pl:
test-client.pl:
Start the server and then use your browser to connect to http://localhost:4242. Hit reload a couple of times. It will work. Then fire the test-client.pl script and it will hang on request number one. Stop the server. Then try it the other way round: First start the server again. Then fire the test-client.pl and this time it will count up requests. Now, as soon as you use your browser to connect to http://localhost:4242 the test-client will stop getting requests through, while the browser does, doing reloads again and again, as if it could grab the socket from the test-client. (Even better: as soon as you close the browser(!), not just the tab, the CLI test-client resumes counting up successful requests.) Although this is a non-forking server, it should process one request after another. Right? But it seems as if it serves only one connection/one client on a first come first serve basis. Blocking all other requests... I've never got my head completely around Socket programming, and in the past I ran into the strangest blocking issues. This here somehow seems related. I've seen the same behavior with Net::Server, POE and Anyevent based server scripts, so it seems to be related to what I am doing with these modules... What am I missing?? In reply to Strange blocking issue with HTTP::Daemon by isync
|
|