Sie befinden sich aktuell in den Blog Blog-Archiven für den folgenden Tag 16.7.2007.
- Allgemein (14)
- BI/DWH/DB (3)
- Deutsch/German (2)
- economics (3)
- graphic (2)
- ITSM (1)
- mobile (4)
- net (11)
- performance (11)
- programming (13)
- science (7)
- security (5)
- storage (3)
- unix (6)
- web (20)
- 9.10.2009: Linux kernel report
- 9.10.2009: 60 GHZ ECMA-387 demonstrated
- 30.9.2009: File system
- 22.9.2009: Code Splitting for Network-Bound Web 2.0 Applications
- 22.6.2009: mobileHacking.org
- 20.6.2009: don't even need a keylogger...
- 8.6.2009: sourcing map
- 27.4.2009: Linux virus writing article by foobar
- 27.4.2009: PhoneGap
- 6.2.2009: CMDB and asset management
Archive für 16.7.2007
tcp_echo
16.7.2007 von pit.
even the echo service is disabled on Linux machines, it’s nevertheless an easy way to figure out spurios network delays. TIn perl the basics are already written in the NET::PING module. I only added some timing to it. If you don’t have the perl modules installed, a workaround is creating a script containing the line
echo $2 | /usr/bin/netcat -v $1 7
which you could than invoke with time scriptname host.domain.dmn string_to_use
here ist the other way
#!/usr/bin/perl
# simple tcp echo programm
# sample usage (verbose mode)
# /xxx/bin/tcp_echo.pl -v 1 -h host.domain.dmn
# /xxx/bin/tcp_echo.pl: host.domain.dmn 2
# res = 1 host host.domain.dmn time: 0.012088
# sample usage (normal mode)
# /root/bin/tcp_echo.pl -h host.domain.dmn
# res = 1 host host.domain.dmn time: 0.010903
#
use strict;
use Getopt::Long;
use Net::Ping;
use Time::HiRes;
use Time::HiRes qw(gettimeofday tv_interval);
my $program_name = $0;
my $timeout = 2;
my $hostname = “localhost”;
my $debug = 0;
sub helpMessage()
{
print “$program_name [-h|-?] [-v #] [-t #] [-h FQDM] [\n”;
print “-help|? this message\n”;
print “-v[erbose] enables debug messages \n”;
print “-t[imeout] timeout (default: 2)\n”;
print “-h[ost] hostname FQDN (default: localhost) \n”;
exit 1;
}
sub run()
{
my $t0 = [gettimeofday];
my $res = pingecho( $hostname, $timeout );
my $t1 = [gettimeofday];
my $elapsed = tv_interval $t0, $t1;
print “res = $res host $hostname time: $elapsed\n”;
}
Getopt::Long::Configure (”bundling”);
my $l_result = GetOptions (
‘help|?’ => sub { helpMessage() },
‘verbose|v=n’ => \$debug,,
‘host|h=s’ => \$hostname,
‘timeout|t=n’ => \$timeout);
print “$program_name: $hostname $timeout \n” if $debug;
&run();
Geschrieben in net, programming | Keine Kommentare »