The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
will a named pipe always be size 0 on filesystem? JamesByars UNIX for Advanced & Expert Users 4 03-01-2008 01:39 PM
fifo or named pipe working? lvkchaitanya UNIX for Dummies Questions & Answers 1 02-06-2008 09:44 AM
Named Pipe contents to a file carl_vieyra UNIX for Dummies Questions & Answers 4 02-26-2007 09:33 PM
Named PIPE Tamil UNIX for Dummies Questions & Answers 2 01-17-2007 12:20 AM
IPC using named pipe sharanbr UNIX for Advanced & Expert Users 1 02-15-2006 01:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-15-2006
Registered User
 

Join Date: Feb 2006
Posts: 16
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 ..
Reply With Quote
Forum Sponsor
  #2  
Old 02-16-2006
Registered User
 

Join Date: Feb 2006
Location: Southern England
Posts: 102
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?
Reply With Quote
  #3  
Old 02-16-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
write (fd, 1, 1)

You might want to review the man page on "write".
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0