On Sat, Feb 27, 2010 at 2:17 AM, Ashish SHUKLA <[email protected]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Vikas Upadhyay writes:
> > Hi All,
>
> > I have two programs, one writes to fifo (writefifo.c) and another reads
> from
> > fifo (readfifo.c) - sources at bottom of the mail).
>
>
>
> > The fifo has been created as myfifo
>
> >                 vi...@myhost:~/prg> ls -l myfifo
>
> >                 prw-r--r-- 1 vikas users 0 Feb 26 04:09 myfifo
>
> > Host is a 64 bit SLES (Suse) 10.
>
>
>
> > When I run writefifo on one terminal & readfifo on another, readfifo
> shows
> > me messages like:
>
> > vi...@myhost:~/prg> ./readfifo
>
> > Inside main
>
> > fd of fifo=3:
>
> > read 300 bytes --->message number #0<---
>
> > read 300 bytes ---><---
>
>
> [...]
>
> > read 300 bytes --->message number #117<---
>
> > read 300 bytes ---><---
>
> > read 300 bytes --->message number #120<---
>
> > read 300 bytes ---><---
>
> > read 0 bytes ---><---
>
> You've not mentioned the actual problem, you're facing. And from reading
> your
> C code, and using my human intelligence, I assumed you expect all message
> numbers to be printed, which in actual execution are skipped because your
> reader/writer programs use different sizes for read/write buffers. Try
> keeping
> them same and enjoy the bliss of synchronization :).
>
>
>
Thanks Ashish for pointing at exactly the right place. Making the size same
makes it work.
Just wondering, keeping different buffers & having a sleep(1) still makes it
work. Any comments on that ?

Regards
Vikas
_______________________________________________
Ilugd mailing list
[email protected]
http://frodo.hserus.net/mailman/listinfo/ilugd

Reply via email to