Dear BrowserUk , the script is almost done, After applying both changes it begun working, but there is something wrong when the walker receives the line from the listener, it receives only a number instead of the complete line.
I put them to print as following:
and got the following:sub listener { my( $Qout ) = @_; require IO::Socket::INET::Daemon; ## Requiring here means other +threads don't carry the redundant weight my $host = new IO::Socket::INET::Daemon( host => '172.24.3.208', port => 7777, timeout => 20, callback => { data => sub { my ($io, $host) = @_; chomp( my $line = <$io> ); return 0 unless $line; print "here line is : $line"; $Qout->enqueue( $line ); ## send work to listener return !0; } }, ); $host->run; return; } sub walker { my( $Qin, $Qout ) = @_; while( $Qin->dequeue ) { ## receive work from listener print "here \$\_ is : $_"; my( $type, $ip, $mac, $bsid, $datecode ) = split( ',', $_ ); $mac =~ tr[-][]d;
Im reading the Thread::Queue documentacion and the example provided looks very similar like your method ... I will keep investigating it. Thanks
In reply to Re^2: Fast provider feeding slow consumer
by leostereo
in thread Fast provider feeding slow consumer
by leostereo
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |