Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seems weird behaviors of mkfifo



Hi,
I think the problem is my poor English, since I totally understand what you mean about pipe behaviors. :p

Actually I have an answer for my question now.

It's the problem of gcc 3.3 which Darwin used as default. For FreeBSD nowadays, system compiler is gcc 3.4. After installing gcc 3.4 via darwin ports and compiling my programs with this up-to-date compiler, named pipe does work as my wish.

FYI, I found some hints about this problem, some part of my problem seems related to fstream:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5799

Sincerely,
Tian-Jian Jiang

2005/3/23 上午 4:50 時,Paul Forgey 提到:

The behavior you are seeing is normal for any posix system. As far as your shell example goes, that's the effects of buffering. The reader won't read until a buffer is written with an underlying write () call to the pipe. When that happens is entirely dependent on the shell. The SIGPIPE's in your C code are normal. It means you tried to read from the read end of a pipe after the writer closed it. You can set SIGPIPE to SIG_IGN and have the read() operation fail with EPIPE instead.

Note what you are trying to do will only work with one client at a time, and unless you arrange for some sort of handshaking, nothing will stop more than one client from trying and garbling your input. Normally two pipes are set up to handshake both ways between the client and the server.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >Seems weird behaviors of mkfifo (From: Tian-Jian "Barabbas" Jiang <email@hidden>)
 >Re: Seems weird behaviors of mkfifo (From: Paul Forgey <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.