DynGig::Multiplex::TCP - Multiplexed TCP Client
use DynGig::Multiplex::TCP; ## imagine these servers are echo servers .. my @server = qw( host:port /unix/domain/socket ... ); my %config = ( timeout => 30, buffer => 'bob loblaw' ); my $client = DynGig::Multiplex::TCP->new( map { $_ => \%config } @server ); my %option = ( timeout => 300, ## global timeout in seconds max_buf => 1024, ## max number of bytes in each read buffer multiplex => 100, ## max number of threads index => 'forward' ## index results/errors by server verbose => *STDERR ## report progress to STDERR ); if ( $client->run( %option ) ) { my $result = $client->result() || {}; my $error = $client->error() || {}; } else { print $client->error(); }
Launches client with the following parameter. Returns 1 if successful. Returns 0 otherwise.
index : index results/errors by server if set to 'forward' timeout : global timeout in seconds max_buf : max number of bytes in each read buffer multiplex : max number of threads verbose : report progress to a file handle opened for write.
Returns undef if no result. Returns a HASH reference indexed either by server or by result (see the index parameter of run().)
Returns undef if no error. Returns a string if a global error occurred, else if errors occurred with individual client/server connections, returns a HASH reference indexed either by server or by result. (see the index parameter of run().)
Socket and IO::Poll
See DynGig::Multiplex
To install DynGig::Multiplex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DynGig::Multiplex
CPAN shell
perl -MCPAN -e shell install DynGig::Multiplex
For more information on module installation, please visit the detailed CPAN module installation guide.