问题描述
Iam从事客户端,使用C ++在Linux上进行服务器编程。
我在后台运行服务器守护程序,我的客户端程序
与服务器进行通信并提取我在屏幕上打印的一些数据。这个东西工作正常但是当我重新定向
stdout到管道时它会挂起来永恒,
例如,
seema @ coma> simple_client |更多
如果我'杀死''服务器守护进程,那么控制最终会返回给shell的
。我需要让它工作,因为
我想将可执行文件与shell脚本集成。请问某人
请解释一下如何修理它?
预先谢谢
Seema
Iam working on Client, Server programming on Linux in C++.
I have a Server Daemon running in the background, my client program
talks to the Server and extracts some data which I
am printing on the screen. This thing works fine but when i redirect
the stdout to pipe it hangs for eternity,
for example,
seema@coma> simple_client | more
If I ''kill'' the Server Daemon, then control is eventually returned back
to the shell. I need to make it work because
i want to integrate executable with the shell script. Can somebody
please explain how to fix it?
Thanks in Advance
Seema
推荐答案
请发布您的代码你希望我们帮助你。
另外,请不要过帖。如果您有c ++语言问题,请在此处发布
。如果它有问题,请在该新闻组中询问。
发布到此新闻组的规则可在
- John Ratliff
Please post your code if you want us to help you with it.
Also, please don''t cross post. If you have a c++ language question, post
it here. If it''s a c question, ask it in that newsgroup.
Rules for posting to this newsgroup are available at
http://www.faqs.org/faqs/by-newsgrou....lang.c++.html
--John Ratliff
这可能是因为更多实用程序在输出之前读取整个文件
。所以,这里更多不会产生任何输出,直到
simple_client关闭其输出流(或退出关闭所有流)。
This is probably because more utility reads a whole file before
outputting it. So, here more does not produce any output until
simple_client closes its output stream (or exits closing all streams).
尝试使用less而不是更多。
Try using less instead of more.
这篇关于将stdout重定向到管道'挂起'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!