ipc - python interprocess querying/control -
ipc - python interprocess querying/control -
i have python based service daemon doing lot of multiplexed io (select).
from script (also python) want query service daemon status/information and/or command processing (e.g. pause it, shut down, alter parameters, etc).
what best way send command messages ("from on process this!") , query processed info ("what result of that?") using python?
i read somewhere named pipes might work, don't know much named pipes, in python - , whether there improve alternatives.
both background service daemon , frontend programmed me, options open :)
i using linux.
pipes , named pipes solution communicate between different processes. pipes work shared memory buffer has interface mimics simple file on each of 2 ends. 1 process writes info on 1 end of pipe, , reads info on other end.
named pipes similar above , except pipe associated real file in computer.
more details @
http://www.softpanorama.org/scripting/pipes.shtmlin python, named pipe files created os.mkfifo call
x = os.mkfifo(filename)
in kid , parent open pipe file
out = os.open(filename, os.o_wronly) in = open(filename, 'r')
to write
os.write(out, 'xxxx')
to read
lines = in.readline( )
edit: adding links so
http://stackoverflow.com/questions/1430446/create-a-temporary-fifo-named-pipe-in-python http://stackoverflow.com/search?q=python+named+pipesyou may want read more on "ipc , python"
http://www.freenetpages.co.uk/hp/alan.gauld/tutipc.htm python ipc
Comments
Post a Comment