my $tcp;

my $tcp_timeout = ($args{"timeout"})?($args{"timeout"}):8;

uxmon::test_deprecated( \%args );

unless( $tcp = $memory{"tcp_$args{frequency}_$tcp_timeout"} ) {
    &uxmon::load_module( "tcp" );
    &uxmon::checker(
	$memory{"tcp_$args{frequency}_$tcp_timeout"} = $tcp = Monitor::tcp->new( $tcp_timeout )
    );
    $tcp->sched_frequency($args{"frequency"});
}

if( ! $args{"service"} ) {
    $args{"service"} = $args{"cmd"};
    if( $args{"port"} ) {
        $args{"service"} .= "(".($args{"port"}).")";
    }
}
{
    my $port;
    my $service;

    foreach $desc (split(",",$args{"service"})) {
	if( $desc =~ /^(.*?)\((.*)\)/ ) {
	    $port = $2;
	    $service = $1;
	}
	else {
	    $port = $service = $desc;
	}
	my $check = $args{"check"}?$args{"check"}:$service;
	$tcp->add_any( $args{"host"}, $port, $service, $args{"send"}, $args{"expect"}, $args{"alias"}.".".$check, $args{"_spec1"} );
    }
}

1;
