python 与别的程序通信_python和java之间的IPC(进程间通信)

1586010002-jmsa.png

First, a little explanation of why I'm asking this question in the first place:

I'm writing a python program (with a wxPython gui) that needs to call a Java AWT program from python and extract data from it. I have an in-process working solution on Windows. I also have an in-process solution on OSX so long as I run the Java app headless. Unfortunately there is no reasonable solution that I have found for running both GUIs within the same process on OSX because both AWT and WX both want the first thread and cannot share the wx message loop.

What I would like to do is to launch a Java program in a separate process from my Python program and establish a pipe or queue or something for passing data (specifically byte arrays) back and forth.

I'd greatly appreciate any suggestions, or even a nudge in the right direction as I have very little experience with IPC.

解决方案

I attempted to code a solution using pipes but it seems that they just aren't well suited to sending multiple messages back and forth with potentially large data attached. Rather, they seem ideal for opening a "worker" style program that runs, responds, and dies.

The tutorial presents TCP and UDP variants of a simple chat program written in 4 languages. I ended up using and modifying the TCP Java client and Python server.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值