通过tcp/ip流式传输不断增长的文件 [英] Stream a continuously growing file over tcp/ip

查看:96
本文介绍了通过tcp/ip流式传输不断增长的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在处理的项目,其中一个硬件正在产生输出,并将其不断写入文本文件中. 我需要做的是在通过简单的tcp/ip连接写入文件时流式传输该文件.

I have a project I'm working on, where a piece of Hardware is producing output that is continuously being written into a textfile. What I need to do is to stream that file as it's being written over a simple tcp/ip connection.

我目前正在尝试通过简单的netcat进行操作,但是netcat仅发送执行时写入的文件部分.它不会继续发送其余部分.

I'm currently trying to that through simple netcat, but netcat only sends the part of the file that is written at the time of execution. It doesn't continue to send the rest.

现在,我有一台服务器在端口9000上监听netcat(仅出于测试目的):

Right now I have a server listening to netcat on port 9000 (simply for test-purposes):

netcat -l 9000

发送命令是:

netcat localhost 9000 < c:\OUTPUTFILE

因此,据我了解,netcat实际上应该在流传输文件,但是一旦发送了执行开始时存在的所有内容,它就会停止运行.它不会终止连接,而只是停止发送新数据.

So in my understanding netcat should actually be streaming the file, but it simply stops once everything that existed at the beginning of the execution has been sent. It doesn't kill the connection, but simply stops sending new data.

如何获取它以连续流式传输数据?

How do I get it to stream the data continuously?

推荐答案

尝试:

netcat localhost 9000 < tail -f /path/to/file

这篇关于通过tcp/ip流式传输不断增长的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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