Agent::Transport - the Transportable Agent Perl module
use Agent::Transport; # for receiving messages: $tcp = new Agent::Transport( Medium => 'TCP', Address => '220.127.116.11:1234' ); # for sending: use Agent::Message; $msg = new Agent::Message( Medium => 'TCP', Body => [ @body ], Address => '18.104.22.168:1234' ); $msg->send;
This package provides an interface to the TCP[/IP] transport medium for agent developers to make use of.
If the Cycle argument is passed and if new() cannot capture the port specified, it will cycle through port numbers until a free port is found. If
new is not passed an Address at all, it assumes '127.0.0.1:24368', and sets Cycle to 1.
This module contains all of the Agent::Transport standard methods. Some non-standard features have also been introduced:
This method is analagous to the accept() function call and is introduced to allow agent programmers to make full use of bi-directional sockets. It simply opens an incoming connection and returns that object, thus allowing you to use a single connection for multiple messages (see
IO::Socket for details). Unfortunately, you'll have to design your own protocol.
Passing a 'From' argument as a referenced scalar, causes accept() to put what it thinks the remote address is into this variable.
Returns $self->address() only. It should really do hostname lookups.
Passing a 'From' argument as a referenced scalar, causes recv() to put what it thinks the remote address is into this variable. Otherwise, recv() functions as described in Agent::Transport.
If you pass send() a 'KeepAlive' argument containing a reference to a scalar, it will set this scalar to the remote socket filehandle. This is meant to be used in conjunction with accept(), and is useful if you would like to have an extended conversation with the remote host.
This module only binds to a specified address. If you have multiple interface addresses (ie: eth0 & eth1), and you want to listen on more than one, you have to bind each seperately.
Steve Purkis <email@example.com>
Copyright (c) 1998 Steve Purkis. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Various people from the perl5-agents mailing list.