The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::TCP - testing TCP program

SYNOPSIS

    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';
        },
    );

DESCRIPTION

Test::TCP is test utilities for TCP/IP program.

METHODS

empty_port
    my $port = empty_port();

Get the available port number, you can use.

test_tcp
    test_tcp(
        client => sub {
            my $port = shift;
            # send request to the server
        },
        server => sub {
            my $port = shift;
            # run server
        },
        # optional
        port => 8080
    );
wait_port
    wait_port(8080);

Waits for a particular port is available for connect.

AUTHOR

Tokuhiro Matsuno <tokuhirom@gmail.com>

THANKS TO

kazuhooku

dragon3

SEE ALSO

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.