Conceptual question on writeable file descriptors - Unix

This is a discussion on Conceptual question on writeable file descriptors - Unix ; Say program A closes it's write half of the connection and then Program B, which was communicating ith Program A (via a pipe), then tries to write to the fd on Program A. Program A would generate SIGPIPE right? If ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Conceptual question on writeable file descriptors

  1. Conceptual question on writeable file descriptors

    Say program A closes it's write half of the connection and then
    Program B, which was communicating ith Program A (via a pipe), then
    tries to write to the fd on Program A. Program A would generate
    SIGPIPE right?

    If Program A generates a SIGPIPE, how can the fd on Program A be ready
    for writing? Ie, if program A closes it's write end, then how can it
    be ready for writing?

  2. Re: Conceptual question on writeable file descriptors

    On Nov 26, 11:33 am, K-mart Cashier wrote:
    > Say program A closes it's write half of the connection and then
    > Program B, which was communicating ith Program A (via a pipe), then
    > tries to write to the fd on Program A. Program A would generate
    > SIGPIPE right?
    >
    > If Program A generates a SIGPIPE, how can the fd on Program A be ready
    > for writing? Ie, if program A closes it's write end, then how can it
    > be ready for writing?


    I'm not entirely sure what you're getting at, but...

    With respect to select(2) and the like, "ready for writing" is sort of
    a misnomer. A more accurate description is that select(2) returns
    when a write to the file descriptor would not block. The write could
    succeed or fail, but in either case it will do so at once, without
    blocking.

    Does that answer your question?

  3. Re: Conceptual question on writeable file descriptors

    On Nov 26, 12:28 pm, fjbl...@yahoo.com wrote:
    > On Nov 26, 11:33 am, K-mart Cashier wrote:
    >
    > > Say program A closes it's write half of the connection and then
    > > Program B, which was communicating ith Program A (via a pipe), then
    > > tries to write to the fd on Program A. Program A would generate
    > > SIGPIPE right?

    >
    > > If Program A generates a SIGPIPE, how can the fd on Program A be ready
    > > for writing? Ie, if program A closes it's write end, then how can it
    > > be ready for writing?

    >
    > I'm not entirely sure what you're getting at, but...
    >
    > With respect to select(2) and the like, "ready for writing" is sort of
    > a misnomer. A more accurate description is that select(2) returns
    > when a write to the file descriptor would not block. The write could
    > succeed or fail, but in either case it will do so at once, without
    > blocking.
    >
    > Does that answer your question?


    Yes, that makes sense. Thanks.

+ Reply to Thread