Messages in this thread | | | From | "Anthony Barbachan" <> | Subject | Re: select() on FIFOs | Date | Thu, 24 Dec 1998 20:43:21 -0500 |
| |
Open the fifo in Read/Write mode (O_RDWR). This will work around the problem as a reader will always exist for your fifo. The problem is that once the first reader closes the fifo your read handle of the fifo is set to readonly.
-----Original Message----- From: Martynas Kunigelis <mkunigelis@alna.lt> To: linux-kernel@vger.rutgers.edu <linux-kernel@vger.rutgers.edu> Date: Thursday, December 24, 1998 9:43 AM Subject: select() on FIFOs
>Hello, > >I am trying to write a pseudo client/server program, where clients talk >to the server through a named pipe. In the server, I intended to have >the FIFO open in O_NONBLOCK mode, and then use select() to check when >there's data to read. However, when a client opens the communication >FIFO, writes some data to it and then closes it, all subsequent select() >calls in the server return, saying that there is data to read in the >FIFO. However, there's no data to read, and the server gets stuck in a >loop: > > select() returns 1 > read() returns 0 > >What is the correct solution? I can get it to work having the server >open() and close() the FIFO in blocking mode for each session, but this >does not appeal to me. I wish a had the Stevens book... :) (Ah, and >input multiplexing is not a problem as the clients will never write to >the FIFO concurrently). > >Please CC: me on all replies, as I'm not subscribed to the list. >Thanks in advance and merry Christmas to everyone! > >-Martynas > >- >To unsubscribe from this list: send the line "unsubscribe linux-kernel" in >the body of a message to majordomo@vger.rutgers.edu >Please read the FAQ at http://www.tux.org/lkml/ >
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |