ping这个小工具大家都非常熟悉,但是他不能ping端口,当我们需要知道目的地址的某端口是否开放时,这时需要用到这个tcping小工具了,Windows没有自带这个小工具,需要自己下载下来,放到指定目录里面。

放到C:\Windows\System32这个文件夹下

我们就针对tcping -t 59.46.9.195 3389进行说明,这个意思就是连续ping服务器59.36.100.195的3389端口,去掉-t就只发送默认的4次tcp包。
现在在测试一下:



语法

C:\Users\Administrator>tcping -help
--------------------------------------------------------------
tcping.exe by Eli Fulkerson
Please see http://www.elifulkerson.com/projects/ for updates.
--------------------------------------------------------------

Usage: tcping [-flags] server-address [server-port]

Usage (full): tcping [-t] [-d] [-i interval] [-n times] [-w ms] [-b n] [-r times] [-s] [-v] [-j] [-js size] [-4] [-6] [-c] [-g count] [-S source_address] [--file] [--tee filename] [-h] [-u] [--post] [--head] [--proxy-port port] [--proxy-server server] [--proxy-credentials username:password] [-f] server-address [server-port]

 -t     : ping continuously until stopped via control-c
 -n 5   : for instance, send 5 pings
 -i 5   : for instance, ping every 5 seconds
 -w 0.5 : for instance, wait 0.5 seconds for a response
 -d     : include date and time on each line
 -b 1   : enable beeps (1 for on-down, 2 for on-up,
                        3 for on-change, 4 for always)
 -r 5   : for instance, relookup the hostname every 5 pings
 -s     : automatically exit on a successful ping
 -v     : print version and exit
 -j     : include jitter, using default rolling average
 -js 5  : include jitter, with a rolling average size of (for instance) 5.
 --tee  : mirror output to a filename specified after '--tee'
 --append : Append to the --tee filename rather than overwriting it
 -4     : prefer ipv4
 -6     : prefer ipv6
 -c     : only show an output line on changed state
 --file : treat the "server-address" as a filename instead, loop through file line by line
          Note: --file is incompatible with options such as -j and -c as it is looping through different targets
          Optionally accepts server-port.  For example, "example.org 443" is valid.
          Alternately, use -p to force a port at command line for everything in the file.
 -g 5   : for instance, give up if we fail 5 times in a row
 -S _X_ : Specify source address _X_.  Source must be a valid IP for the client computer.
 -p _X_ : Alternate method to specify port
 --fqdn : Print domain name on each line if available
 --ansi : Use ANSI color sequences (cygwin)
 --color: Use Windows color sequences

HTTP Options:
 -h     : HTTP mode (use url without http:// for server-address)
 -u     : include target URL on each line
 --post : use POST rather than GET (may avoid caching)
 --head : use HEAD rather than GET
 --proxy-server : specify a proxy server
 --proxy-port   : specify a proxy port
 --proxy-credentials : specify 'Proxy-Authorization: Basic' header in format username:password

Debug Options:
 -f     : force tcping to send at least one byte
 --header : include a header with original args and date.  Implied if using --tee.
 --block  : use a 'blocking' socket to connect.  This prevents -w from working and uses the
            default timeout (as long as 20 seconds in my case).  However it can detect an actively
            refused connection vs a timeout.

        If you don't pass server-port, it defaults to 80.

翻译

-t 不停的发送数据包直到 按ctrl+c 停止,可以用此命令做小破坏。

-n 5 一次发送 5 个数据包,默认一次发送4个 : tecping -n 5 www.baidu.com 会tcping 百度5次,也可以跟其他数字。

-i 5 5秒发送一个数据包 : tcping -i 5 www.baidu.com 每间隔5秒tcping一次百度,也可以跟其他数字,也可以跟小数 :tcping -i 0.5 www.baidu.com 每隔 0.5秒tcping 一次百度。

-w 0.5 tcping不通的等待时间 tcping通则忽略次参数 : tcping -w 0.5 www.baidu.com 如果ping不同会等待0.5秒,默认tcping不通等2s,tcping 通则忽略此参数。

-d 在每行前面显示详细日期时间。

-b 1-4 ping的时候会响铃,参数4会一直响铃 : tcping -b 4 www.baidu.com
每显示一行内容就会响铃一次,默认会响铃4次

-r 5 每发送5个数据包重新查找主机一次(通过DNS或路由查找)

-s ping通就立即退出

-v 显示版本信息

-j 使用默认的方法求ping的均值减小波动,网络有一定的不稳定性用此参数可以减小波动。

-js 5 用5个实例求平均值减小波动,使用这个参数系统会tcping 5次然后求出平均值作为一次结果显示,减小波动。

–tee 将结果输出到指定位置 :tcping –tee d:\test.txt192.168.0.100 会将ping的结果保存在d盘下的test文件