Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^9: Problem handling 2 simultaneous socket streams

by zentara (Archbishop)
on Oct 05, 2011 at 09:25 UTC ( #929742=note: print w/ replies, xml ) Need Help??


in reply to Re^8: Problem handling 2 simultaneous socket streams
in thread Problem handling 2 simultaneous socket streams

Should each of my stream subroutines use the sysread as well?

Your code is kind of complex for me to setup and run and test myself. However, if you are experiencing blocking problems, yes, switch to sysread. The other thing to try is to put a timeout in your select statement, I noticed you have none.

while(my @ready = $sockets->can_read) { #got data # add a timeout to your select while(my @ready = $sockets->can_read (.1) ) { } # 100 ms timeout

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re^9: Problem handling 2 simultaneous socket streams
Download Code
Re^10: Problem handling 2 simultaneous socket streams
by PhillyR (Acolyte) on Oct 06, 2011 at 16:46 UTC

    zentara,
    I created a new post for this problem but I think the basic problem now is creating another thread to do additional processing after a thread for monitoring STDIN has been created. Link below:

    http://perlmonks.org/index.pl?node_id=930015

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929742]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-09-18 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (124 votes), past polls