Test::TCP - testing TCP program
use Test::TCP; test_tcp( client => sub { my $port = shift; # send request to the server }, server => sub { my $port = shift; # run server }, );
using other server program
test_tcp( client => sub { my $port = shift; # send request to the server }, server => sub { exec '/foo/bar/bin/server', 'options'; }, );
Test::TCP is test utilities for TCP/IP program.
my $port = empty_port();
Get the available port number, you can use.
test_tcp( client => sub { my $port = shift; # send request to the server }, server => sub { my $port = shift; # run server }, # optional port => 8080 );
wait_port(8080);
Waits for a particular port is available for connect.
You can call test_tcp() twice!
test_tcp( client => sub { my $port1 = shift; test_tcp( client => sub { my $port2 = shift; # some client code here }, server => sub { my $port2 = shift; # some server2 code here }, ); }, server => sub { my $port1 = shift; # some server1 code here }, );
Tokuhiro Matsuno <tokuhirom@gmail.com>
kazuhooku
dragon3
charsbar
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::TCP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::TCP
CPAN shell
perl -MCPAN -e shell install Test::TCP
For more information on module installation, please visit the detailed CPAN module installation guide.