tcping 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

tcping 命令安装:


-bash/zsh: tcping command not found

#Fedora
dnf install tcping

#OS X
brew install tcping

#Cent OS
yum install tcping

tcping 命令补充说明:


tcping / tcping.exe 是一个控制台应用程序,其操作类似于“ping”,但它通过 tcp 端口工作。测量系统到 [SYN]、接收目标的 [SYN][ACK] 和发送 [ACK] 的时间。

注意不包括最后一个 ACK 的时间,仅包括从发送端连接到线路所需的时间,即 tcping 测量在它自己和远程主机之间执行 TCP 3 次握手(SYN、SYN/ACK、ACK)所需的时间。这允许 (SYN, SYN/ACK) 的行程时间近似于 ICMP(请求,响应)等效项的行程时间。

tcping 命令语法:


tcping [-tdsvf46] [-i interval] [-n times] [-w interval] [-b n] [-r times][-j depth] [--tee filename] [-f] destination [port]

tcping 命令选项:


OPTIONS
    -4      Prefer using IPv4

    -6      Prefer using IPv6

    -t      ping continuously until stopped via control-c

    -n count
            send _count_ pings and then stop.  Default 4.
    
    -i interval
            Wait _interval_ seconds between pings.  Default 1.  Decimals permitted.
    
    -w interval
            Wait _interval_ seconds for a response.  Default 2.  Decimals permitted.

    -d      include date and time on every output line
    
    -f      Force sending at least one byte in addition to making the connection.

    -g count
            Give up after _count_ failed pings.
    
    -b type
            Enable audible beeps.
            '-b 1' will beep "on down".  If a host was up, but now its not, beep.
            '-b 2' will beep "on up".  If a host was down, but now its up, beep.
            '-b 3' will beep "on change".  If a host was one way, but now its the other, beep.
            '-b 4' will beep "always".

    -c      only show output on a changed state
    
    -r count
            Every _count_ pings, we will perform a new DNS lookup for the host in case it changed.

    -s      Exit immediately upon a success.        

    -v      Print version and exit.

    -j      Calculate jitter.  Jitter is defined as the difference between the last response time and the historical average.

    -js depth
            Calculate jitter, as with -j but with an optional _depth_ argument specified. If _depth_ is specified tcping will
            use the prior _depth_ values to calculate a rolling average.

    --tee _filename_
            Duplicate output to the _filename_ specified.  Windows can still not be depended upon to have a useful command line 
            environment. Don't tease me, *nix guys.

    --append
            When using --tee, append to rather than overwrite the output file.
            
    --file
            Treat the "destination" option as a filename.  That file becomes a source of destinations, looped through on a
            line by line basis.  Some options don't work in this mode and statistics will not be kept.


    destination
            A DNS name, an IP address, or (in "http" mode) a URL.
            Do not specify the protocol ("http://") in "http" mode.  Also do not specify server port via ":port" syntax.
            For instance:   "tcping http://www.elifulkerson.com:8080/index.html" would fail
            Use the style:  "tcping www.elifulkerson.com/index.html 8080" instead.
                                
    port
            A numeric TCP port, 1-65535.  If not specified, defaults to 80.

    --header
            include a header with the command line arguments and timestamp.  Header is implied if using --tee.
            
HTTP MODE OPTIONS   
    -h      Use "http" mode.  In http mode we will attempt to GET the specified document and return additional values including
            the document's size, http response code, kbit/s.
    -u      In "http" mode, include the target URL on each output line.
    
    --post  Use POST instead of GET in http mode.
    --head  Use HEAD instead of GET in http mode.
    --get   Shorthand to invoke "http" mode for consistency's sake.

    --proxy-server _proxyserver_
            Connect to _proxyserver_ to request the url rather than the server indicated in the url itself.
    --proxy-port _port_
            Specify the numeric TCP port of the proxy server.  Defaults to 3128.
    --proxy-credentials username:password
            Specify a username:password pair which is sent as a 'Proxy-Authorization: Basic' header.


RETURN VALUE
    tcping returns 0 if all pings are successful, 1 if zero pings are successful and 2 for mixed outcome.

tcping 命令实例:


tcping 测试 IP 及 6379 端口:

$ tcping -d 127.0.0.1 6379

Probing 127.0.0.1:6379/tcp - Port is open - time=1.632ms
Probing 127.0.0.1:6379/tcp - Port is open - time=0.239ms
Probing 127.0.0.1:6379/tcp - Port is open - time=0.266ms
Probing 127.0.0.1:6379/tcp - Port is open - time=0.842ms

Ping statistics for 127.0.0.1:6379
     4 probes sent.
     4 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:
     Minimum = 0.239ms, Maximum = 1.632ms, Average = 0.745ms

-----------
如果关闭显示为:

$ tcping 127.0.0.1 6379   

127.0.0.1 port 6379 closed.

tcping 命令扩展阅读:




tcping 命令评论