|
|
| There's more than one way to do things | |
| PerlMonks |
Re: Problem handling 2 simultaneous socket streamsby BrowserUk (Patriarch) |
| on Sep 15, 2011 at 14:55 UTC ( [id://926162]=note: print w/replies, xml ) | Need Help?? |
|
Using buffered IO with non-blocking sockets is a no-no. readline() (<>) won't return until it sees the current delimiter (typically "\n"); if the other end sends data without a delimiter, it will block; if the other end never gets around to sending a delimiter, then it will block forever. The solution is to use read, sysread or recv, but then you'll need to buffer and track the delimiters yourself, which gets awfully messy. The whole thing would be far simpler using threads. 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.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||