将字符串从一个控制台应用程序发送到另一个 [英] Send strings from one console application to another

查看:68
本文介绍了将字符串从一个控制台应用程序发送到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所拥有的:

两个控制台应用程序(目标框架4)。应用程序 A 完成所有工作, B 每10秒显示一次状态。 A 运行了将近300,000条sql条目并执行其他工作-输出最冗长,并且很难在有关进度的一般概述信息中加以挤压。

Two console applications (target framework 4). Application A does all the work, B displays status every 10 seconds. A runs through nearly 300,000 sql entries and performs miscellaneous work - output is most verbose and its hard to squeeze in general overview information about progress.

我需要什么:

我的目标是让 A 首先执行 B 然后发送或将字符串传递到 B ,以便它可以使用这些字符串的新值刷新自身。这样可以为正在观察整个操作过程的用户提供一个很好的指示。

My goal would be to have A first execute B and then "send" or pass strings over to B so that it can refresh itself with the new values of those strings. It would provide the user who is observing a good indication of what's going on with the whole operation.

您建议如何完成此操作。 WCF,命名管道?我想我可以使应用 A 服务器和应用 B 成为某种类型的客户端。

What do you recommend to accomplish this. WCF, named pipes? I guess I could make app A the server and app B a client of some sorts.

视觉示例:请注意,应用程序A的文本多了10倍(图片只是示例)

Visual example: note that application A has about 10x more text (picture is just example)

推荐答案


  • 使B首先执行A。

  • A将其详细日志记录写入标准输出。

  • B读取A的标准输出(google如何重定向进程的输入/输出/错误)

  • B汇总信息并在其标准输出上编写干净的日志。

  • 当A退出,B也退出。

    • Make B first execute A.
    • A write its verbose logging to standard output.
    • B reads A's standard output (google how you can redirect input/output/err of a process)
    • B aggregate information and write a clean log on its standard output.
    • When A exits, B exits too.
    • 简单!

      这篇关于将字符串从一个控制台应用程序发送到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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