小编Nic*_*ick的帖子

/dev/tcp/host/port, /dev/udp/host/port 这是什么内核模块?

我在 bash(1) 手册页中注意到了这一点。是否有提供此接口的操作系统或某些内核模块?在我的 Debian 安装上尝试过,但这些设备不存在。

谢谢

      /dev/tcp/host/port
             If host is a valid hostname or Internet address, and port is an integer  port  number  or  service
             name, bash attempts to open the corresponding TCP socket.
      /dev/udp/host/port
             If  host  is  a  valid hostname or Internet address, and port is an integer port number or service
             name, bash attempts to open the corresponding UDP socket.
Run Code Online (Sandbox Code Playgroud)

解决方案/答案:这是有效的,它是外壳的一个功能。去测试:

$ nc -l -p 5555

echo Hello > /dev/tcp/localhost/5555

$ nc -l -p 5555
Hello
Run Code Online (Sandbox Code Playgroud)

很酷。

drivers debian tcp udp

1
推荐指数
1
解决办法
1100
查看次数

标签 统计

debian ×1

drivers ×1

tcp ×1

udp ×1