简体   繁体   English

从Windows调用Linux进程并接收标准输出

[英]Invoking a Linux process from Windows and receiving stdout

I have a legacy application in our company built on... ahem; 我的公司有一个基于...的遗留应用程序。 Classic VB (VB 6). 经典VB(VB 6)。 It has got a optimizer(CPLEX MIP Solver) component running on a Linux server and is developed in Java. 它具有在Linux服务器上运行的优化程序(CPLEX MIP Solver)组件,并使用Java开发。

If we want to provide a Windows UI to invoke the optimizer instance on a remote linux server; 如果要提供Windows UI来调用远程linux服务器上的优化器实例,请执行以下操作: how should I implement it? 我应该如何实施?

The optimizer will pump out messages about its progress and it needs to be displayed on the UI. 优化器将抽取有关其进度的消息,并且需要将其显示在UI上。

I thought of two options as of now. 到目前为止,我想到了两个选择。

  1. Invoke the linux process with PLINK. 使用PLINK调用linux进程。 Not sure whether it can bring STDOUT to windows. 不确定是否可以将STDOUT带到Windows。
  2. Build a small java app and load it as a daemon on the linux server and communicate over TCP. 构建一个小的Java应用程序,并将其作为守护程序加载到linux服务器上,并通过TCP进行通信。

Would appreciate expert advise. 将不胜感激专家的建议。 Thank for the helping hand! 感谢您的帮助!

You can also use SSH to run commands and capture their output, for example, for .NET http://www.codeproject.com/KB/IP/sharpssh.aspx 您还可以使用SSH运行命令并捕获其输出,例如对于.NET http://www.codeproject.com/KB/IP/sharpssh.aspx

You can automate the login process using keys. 您可以使用键自动执行登录过程。

到目前为止,PLINK选项最容易实现(前提是您具有类似于Win32 API中的system()调用的功能)

If the component is written in Java, why don't you just use it on Windows? 如果该组件是用Java编写的,为什么不只在Windows上使用它呢? If it's not and I misunderstood you, do you have the source code? 如果不是,并且我误解了您,那么您有源代码吗? If yes, just copy it to Windows and recompile. 如果是,只需将其复制到Windows并重新编译。 If it really is Linux-specific, Cygwin might be a nice option too. 如果确实是特定于Linux的,则Cygwin可能也是不错的选择。 However, it still requires the original source code. 但是,它仍然需要原始源代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM