Why are processes blocked when open FIFO
<p>I write a test for FIFO. Server writes string "hello" to the client through FIFO. But it seems that the two processes are blocked.I think the FIFO are opened for writing and reading by server and client. But the two processes output nothing.</p>

<pre><code>/* FIFO test */

#include &lt;stdio.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys.stat.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;unistd.h&gt;
#include &lt;string.h&gt;
#include &lt;errno.h&gt;

#define FIFOPATH  "/home/hel/fifo" // define file path 

int client(void);
int server(void);

int main(void)
{
    pid_t pid;

    /* create FIFO */
    if (mkfifo(FIFOPATH, S_IRUSR | S_IWUSR) &lt; 0) {
        if (errno == EEXIST) { // already exists, ok 
        }

        /* error */
        else {
            exit(-1);
        }
    }
    /* create process */
    pid = fork();
    if (pid &lt; 0) { // error, process exits.
        exit(-1);
    } else if (pid == 0) { // child, server
          server();

          return 0; // exit
    }

    /* parent, client */
    client();

    return 0;
}       

/* server */
int server(void)
{
    int ret;
    int fd;

    /* open fifo for writing */
    if ((fd = open(FIFOPATH, 0200)) &lt; 0) {
        printf("%s\n", strerror(errno));
        return -1; // error
    }

    ret = write(fd, "hello", 5);
    close(fd);

    return 0;
}

/* client */
int client(void)
{
    char recvBuf[100];
    int fd;
    int ret;

    /* open fifo for reading */
    if ((fd = open(FIFOPATH, 0400)) &lt; 0) {
        printf("%s\n", strerror(errno));
        return -1; // error
    }

    ret = read(fd, recvBuf, 5);
    printf("ret: %d %d\n", ret, fd);
    printf("client receive %s\n", recvBuf);

    close(fd);
    return 0;
}
</code></pre>