我使用了跟随netcat
。
$ netcat --version
netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003 Giovanni Giacobbi
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of
the GNU General Public License.
For more information about these matters, see the file named COPYING.
Original idea and design by Avian Research <hobbit@avian.org>,
Written by Giovanni Giacobbi <giovanni@giacobbi.net>.
在以下示例中,netcat
将挂起。
sed 's/$/\r/g' <<EOF | netcat -v httpbin.org 80
GET /get HTTP/1.1
Host:httpbin.org
EOF
以下网址针对同一问题,但我不确定netcat
的哪种风格,因为我在-q
找不到我使用的netcat
选项。
https://serverfault.com/questions/512722/automatically-close-netcat-connection
输入完成后有人知道如何退出netcat
吗?
答案 0 :(得分:0)
使用通常用于指示终端窗口中的输入结束条件的任何机制。在Linux / Unix系统上,您可以通过键入任何定义为eof
命令输出中显示的stty -a
字符的内容来完成此操作。传统上,eof
字符是Control-D。在Windows上,您可以键入Control-Z,然后按Enter键。