IPC using named pipe

Hi All,

I am facing a vague issue while trying to make two process talk to each
other using named pipe.

read process

The process which reads, basically creates FIFO using
mkfifo - ret_val = mkfifo(HALF_DUPLEX, 0666) func.

It then opens the pipe using open func - fd = open (HALF_DUPLEX,O_RDONLY);

After this read function is called - numread = read(fd, test_data, MAX_BUF_SIZE);

Write process

This opens pipe fd = open(HALF_DUPLEX, O_WRONLY);

Then write is done to the pipe - write (fd, 1, 1);

I am finding that even though i am writing a value of 1, it gets
reflected as 255 by read process.

One thing I noticed is that the file descriptor returned for read process
and write process are both different as can be seen by the
program output below

read process - @ 0 NS Created pipe successfully fd = 6
read process - Read fd = 6

write process - Opened pipe for writing only .. fd = 3
write process - New request with data rqst = 1 fd = 3

read process - Received data from test .. ff

Could you please help ..

cut the code too a minimum and post.

have you tried cat'ing the fifo while the writer is working?
or echo'ing to it while the reader runs?

write (fd, 1, 1) :eek:

You might want to review the man page on "write".