in reply to Re: Optimized remote ping (syn/ack)
in thread Optimized remote ping

Hi BrowserUk,

For my problem, you have hit the solution right on target. I checked the code and its response time is really what i needed. But couldnt understand the below line,

$p->port_number( getservbyname( "http", "tcp" ) );
I wanted to check reachability on the port '3000', so i modified it to below line,
$p->port_number( getservbyname( "3000", "tcp" ) );

But i think i made some mistake in the parameters as the code is still taking echo port(i.e., 7).

Please explain me the above line.

Thanks in advance.

Replies are listed 'Best First'.
Re^3: Optimized remote ping (syn/ack)
by themonk (Acolyte) on Jul 17, 2015 at 18:45 UTC

    I got the correct parameters,

    $p->port_number("3000", "tcp");

    Explanation:

    getservbyname function takes the first parameter and sends its defined port to tcp. E.g., "ftp" => 22, "http" => 80 If custom port is to be mentioned, dont use "getservbyname".

    Correct me if my understanding is wrong.

    Thanks guys for all the help. BTW, the response time now is "5secs for 50 IP's" GREAT Response time. :-)

        I made the necessary changes in the code.

        currently I am running on localhost...so according only "127.0.0.1"should be pingable on port "3000".

        But I get this IP "127.115.99.245" also pingable as TRUE. is there some more changes like timeout or something which i might need to tweak around.