Stdin as InterprocessConnection


#1

Hi there,

I’m writing a sort of playback server which I want to controll from a different process. So I want to use the InterprocessConnection.
To keep all options I thought, I could also connect it to the stdin.
Is that possible?
Is there a special NamedPipe for that?
Or will I have to read in the main loop and call the callback of the IPC myself?

2nd question, is the MessageBlock in the callback always a full package, or will I have to check myself, if there will be more data?

Thanks…


#2

On Linux you could use /proc/self/fd/0 as the name for the pipe. I haven’t tried this but that should open stdin on linux. I’m afraid, OS X doesn’t have the /proc pseudo filesystem so this trick won’t work. It would probably be OK’ish to implement on OS X/iOS but Windows would probably be a real pain. It might not even be possible.

 

Yes. It will always have a full package.


#3

Thanks @fabian, that sounds really too complicated. I worked around by keeping the command parser out of the connection. So it can be called either by an instance of InterProcessConnection or by my own thread which is just waiting for input on stdin.