POE::Component::Client::TCPMulti

POE::Component::Client::TCPMulti is a high performance client TCP library.
Download

POE::Component::Client::TCPMulti Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Scott McCoy
  • Publisher web site:
  • http://search.cpan.org/~tag/POE-Component-Pool-Thread-0.015/Thread.pm

POE::Component::Client::TCPMulti Tags


POE::Component::Client::TCPMulti Description

POE::Component::Client::TCPMulti is a high performance client TCP library. POE::Component::Client::TCPMulti is a high performance client TCP library.SYNOPSIS # Short Usage POE::Component::Client::TCPMulti->create ( InputEvent => sub { printf "%s:%d: %s", $_->ADDR, $_->PORT, $_; }, SuccessEvent => sub { printf "%s:%d: Connection Recieved", $_->ADDR, $_->PORT; $_->yield( send => "" ); }, inline_states => { _start => sub { $_->yield( connect => "127.0.0.1", $_ ) for 1..1024; }, }, InputTimeout => 15, ); # Longer Usage POE::Component::Client::TCPMulti->create ( InputEvent => sub { $_->yield(send => $_->ID, "Some Stuff"); }, Initialize => sub { $_->input_filter ( "POE::Filter::Block", BlockSize => 4); }, ErrorEvent => &ErrorHandle, Disconnected => &ErrorHandle, TimeoutEvent => &TimeoutHandle, FailureEvent => &FailureHandle, SuccessEvent => sub { $_->filter("POE::Filter::Line"); # Set timeout for this connection to 350 seconds. $_->timeout(350); # This state is part of the component interface $_->yield(send => $_->ID, "Some Data"); }, Domain => AF_INET, # Optional Alias => "MySession", # Optional InputTimeout => 360, # Seconds, Optional ConnectTimeout => 30, # Seconds, Optional Timeout => 30, # Seconds, Optional Filter => "POE::Filter::Something", # Optional inline_states => { _start => sub { $_->yield(connect => q(127.0.0.1), 25); # _start isn't needed if you use an alias. }, }, args => $Session_Args, # Optional object_states => $Object_States, # Optional package_states => $Package_States, # Optional ); # This should be done from within a state in the TCPMulti # Session. Its purpose is to allow prepropigation of the # connection heap as well as connection specific timeout # Settings. POE::Component::Client::TCPMulti->connect ( RemoteAddress => "127.0.0.1", RemotePort => 25, BindAddress => "127.0.0.1", # Optional BindPort => 0, # Optional ConnectTimeout => 50, # Connect only. InputTimeout => 300, # Input only. Heap => %Propigation );POE::Component::Client::TCPMulti is a very lightweight, highly optimized component designed for large numbers of simultanious outgoing connections. The major advantage to this module over POE::Component::Client::TCP is that it runs in a single session, reguardless of the number of outgoing simultanious connections. I have found this in fact to use considerable less overhead than POE::Component::Client::TCP in high traffic. The disadvantage lies mearly in the API complexity over POE::Component::Client::TCP.It is in fact due to this added API complexity that I decided to create a seperate module, rather than altering POE::Component::Client::TCP . POE::Component::Client::TCP is a great module and this is not designed to completely replace it. It is however designed as a solution for extremely high traffic situations when the overhead of an individual session for each outgoing connection is not appropriate for the added simplicity in the API. Especially considering that this API is not really *that* much more complex. Requirements: · Perl


POE::Component::Client::TCPMulti Related Software