Window 下的netcat的安装及使用

今天在做Apache Flink 统计“将每5秒输出一次这5秒内每个单词出现的次数”的开发的时候,遇到一个问题:如何监听本地机的指定端口? 于是查阅资料了解到Netcat 工具,该工具已是GPL(the GNU General Public License) 下面的一个Project了(http://netcat.sourceforge.net/

Netcat 是什么:

Netcat是一个功能强大的网络实用程序,它使用TCP/IP协议在网络连接之间读写数据。
它被设计成一个可靠的“后端”工具,可以直接使用或容易地由其他程序和脚本驱动。同时,它是一个功能丰富的网络调试和探索工具,因为它几乎可以创建您需要的任何类型的连接,并且具有几个有趣的内置功能。

Netcat 提供了哪些主要功能:

1、任何端口的出站和入站连接(TCP或UDP)(Outbound and inbound connections, TCP or UDP, to or from any ports.)。
2、特色隧道模式,也允许特殊的隧道,如UDP到TCP,与指定所有网络参数的可能性(源端口/接口,监听端口/接口,远程主机允许连接到隧道。(Featured tunneling mode which allows also special tunneling such as UDP to TCP, with the possibility of specifying all network parameters (source port/interface, listening port/interface, and the remote host allowed to connect to the tunnel. )
3、内置端口随机扫描功能(Built-in port-scanning capabilities, with randomize)。
4、高级使用选项,如缓存发送模式(每N秒一行)和hexdump(到stderr或指定文件)的trascommitted和received数据(Advanced usage options, such as buffered send-mode (one line every N seconds), and hexdump (to stderr or to a specified file) of trasmitted and received data. )。
5、可选的RFC854 telnet代码解析器和响应器(Optional RFC854 telnet codes parser and responder.)

Windows 下的安装与使用:

1、下载,下载地址:https://eternallybored.org/misc/netcat/

 2、将下载的Netcat 解压

3、将文件夹中的所有内容复制到C:\Windows\System32的文件夹下

4、打开命令界面:Windows+R  cmd

5、监听某个端口号:nc -l -p 9000 监听9000端口号 注:windows的cmd里nc的命令在指定端口的时候要额外加 -p

其实到这里简单的使用就结束了,因为我这 “将每5秒输出一次这5秒内每个单词出现的次数” 开发功能,只需要提供Flink监听的端口号,并与之交互就可以了。如需了解更多Netcat 的更多其他功能请参考如下地址:

https://blog.csdn.net/mtj66/article/details/74959287(简单的聊天传文件用法)
https://blog.csdn.net/opencpu/article/details/46939449(详细用法)

 

本文参考:

 https://www.jianshu.com/p/77b492441805

http://netcat.sourceforge.net/

https://blog.csdn.net/qq_37585545/article/details/82250984

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值