From: Robert Klemme Date: 2005-07-12T18:30:49+09:00 Subject: Re: Interprocess communication Jonas Galvez wrote: > I have a Python script running as daemon. I need a way to have a Ruby > script send a message to it and read a response. I've been reading > about pipes and fifo but it's all very confusing. > > Just thought I'd ask before trying anything: what's the safest and > easiest way to accomplish this in Ruby? Depends on which changes you can do to the python script. Does it offer some kind of messaging functionality already? If you can start from scratch (for example because you have to change the phython script anyway) you can do any of these: - make the python script open a pair of named pipes, one for reading and one for writing answers. This works good only if you do have just a single client (your ruby script) - make the phython script open a unix domain socket (which is accessible only from localhost). That way you can have several clients connect but your phython script must handle these. - dedicate a directory for exchange of messages via files. You then need some kind of locking and a protocol, who writes which files there etc. It really depends on your situation and requirements. If you provide more input we might be able to come up with a more concrete suggestion. Kind regards robert