|
|
| Think about Loose Coupling | |
| PerlMonks |
threads + sockets stalling questionby BrowserUk (Pope) |
| on Mar 16, 2010 at 13:09 UTC ( #828917=perlquestion: print w/ replies, xml ) | Need Help?? |
|
BrowserUk has asked for the
wisdom of the Perl Monks concerning the following question:
I attempted to extend the sample code I posted in Re: Transfer a hash using client and server in perl to make it do and handle concurrent clients. I tried this:
Which works perfectly. It serially connects to the server (twice), transmits a couple of hashes and disconnects. The server then awaits further connection until ^C. But if you uncomment the #async{ & }->detach; lines in order to allow the clients to run concurrently, nothing happens. The listener starts and awaits a connection. The clients loop is entered and the async() is dispatched, but the thread never starts and async doesn't return. No errors. Just nothing. But the weird part is, if I connect to the listener from an external process (telnet), the client threads start, run concurrently and finish as designed. So the question is, what is it about connecting from an external process that causes the in-process client threads to start? Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||