In my previous post about named pipes, I mentioned that, "there has to be a reading process "attached" for the other side of the pipe. If you try to open pipe for writing and there is no reading process, open will hang waiting for it"
But there can be issues if reading process is killed/ternminated after attching to FIFO. In that case there will not be any listner on the other end and writing process would give "Broken pipe" error.
In that case you could use command lsof
lsof /tmp/myfifo
Output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
wr 64769 isurusa 3w FIFO 202,3 0t0 67668074 /tmp/myfifo
rd 64781 isurusa 3r FIFO 202,3 0t0 67668074 /tmp/myfifo
Obove output can be processed and make sure there is a propper listner attched to FIFO.
Below is some C++ code snipet for that.
No comments:
Post a Comment