NAME
IO::Socket::Forwarder - bidirectionally forward data between two sockets
SYNOPSIS
use IO::Socket::Forwarder qw(foward_sockets);
forward_sockets($sock1, $sock2);
forward_sockets($sock3, $sock4, debug => 1);
DESCRIPTION
This module allows to forward data between two sockets bidirectionally.
IO::Socket::SSL sockets are also supported.
FUNCTIONS
- forward_sockets($sock1, $sock2, %opts)
-
Reads and writes data from both sockets simultaneously forwarding it.
On return both sockets will be closed.
This function automatically detects if any of the sockets is of type IO::Socket::SSL and doesn't require any extra configuration to handle them.
The following options are accepted:
- debug => 1
-
turn on debugging. I
- io_chunk_size => $size
-
maximun number of bytes allowed in IO operations
- io_buffer_size => $size
-
size of the buffers used internally to transfer data between both sockets
- buffer_1to2 => $data
- buffer_2to1 => $data
-
these options allow to preload some data into the buffers used for transferring data between the two sockets.
SEE ALSO
The samples directory contains a couple of scripts showing how to use this module.
BUGS AND SUPPORT
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IO-Socket-Forwarder or just send my an email with the details.
AUTHOR
Salvador Fandiño (sfandino@yahoo.com).
COPYRIGHT
Copyright 2009-2010 by Qindel Formacion y Servicios S.L.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.