simple inter-process communication

后端 未结 3 890
盖世英雄少女心
盖世英雄少女心 2020-12-29 06:10

I\'m looking for a simple way to pass messages from one process (Perl script, short-lived) to another (Python script, long-running) - both processes local to the sa

相关标签:
3条回答
  • 2020-12-29 06:38

    And for powered-up communications in the same style as socket, consider looking at 0MQ. It can make use of different communication technologies depending where your two apps are located, and even for local processes it's very easy to use and solves the problems for you.

    http://zeromq.org

    0 讨论(0)
  • 2020-12-29 06:51

    In general you are interested in sockets. A good place to get just the needed rough information is the documentation of IO::Socket::INET or more basic socket-stuff in perl from perldoc perlipc

    0 讨论(0)
  • 2020-12-29 06:53

    It turns out that interprocess communication is, while on the surface straightforward, actually fraught with complications. Whatever anyone tells you here in terms of a simplified answer, always keep in mind that there is probably a lot of caveats that are being left unsaid.

    Now with that disclaimer out of the way, I claim that what you likely want are message queues. This is based on the fact that you did not include an ip address in your example api. If you need to go across machines, you will want sockets. However, I think you will find message queues to be simpler to understand if you can deal with the fact that this is only for communicating with processes on the same machine.

    A good starting point for perl is:
    http://perldoc.perl.org/IPC/Msg.html

    for python, this seems to explain (ignore the other kinds of ipc like semaphores):
    http://semanchuk.com/philip/sysv_ipc/

    0 讨论(0)
提交回复
热议问题