侦听网络端口并将数据保存到文本文件 [英] Listen on a network port and save data to a text file

查看:108
本文介绍了侦听网络端口并将数据保存到文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux中是否有一些简单的方法可以侦听网络上的数据并将其保存到文本文件中?

Is there some easy way in linux to listen for data on network and save them to a text file?

谢谢.

推荐答案

Netcat是您的朋友.

Netcat is your friend here.

nc -l localhost 10000 > log.txt

Netcat将侦听端口10000上的连接,将接收到的任何内容重定向到log.txt.

Netcat will listen for a connection on port 10000, redirect anything received to log.txt.

这篇关于侦听网络端口并将数据保存到文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆