Not able to read from named pipe in Java

前端 未结 1 762
醉梦人生
醉梦人生 2020-12-11 20:59

I am creating a named pipe using JNI by calling the mkfifo() command. I am using mode = 0666.

I am then trying to write into the pipe using Java, but I get stuck whi

相关标签:
1条回答
  • 2020-12-11 21:28

    That's how named pipes on *nix work. You're getting stuck at opening the pipe. Opening a fifo for writing will block until someone opens it for reading.

    You'll deadlock if you try to read/write to the pipe from the same thread synchronously, you'ld have to either switch to NIO, or create one thread that reads from the fifo and one thread that writes to it.

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