[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
open() on Unix-Domain Sockets?
- To: linux-il(at-nospam)linux.org.il
- Subject: open() on Unix-Domain Sockets?
- From: Shlomi Fish <shlomif(at-nospam)techst02.technion.ac.il>
- Date: Wed, 2 May 2001 14:19:15 +0300 (IDT)
- Delivered-To: linux.org.il-linux-il@linux.org.il
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
Hi!
Not a long time ago, Mulix gave a lecture about daemons in which he
demonstarated how he wrote a signature generating daemon, that write a
random signature to a named pipe. However, he did say that if more than
one process opens the named pipe simlutaneously the result is unexpected.
Which got me thinking: why not use a Unix-domain socket which supports
more than one simultaenous distinct connections. The main reason of course
is that cat ~/my-unix-domain-socket.sock won't work, because one should
use connect() to open it instead of open(). But if it could?
Why not make an open call on a UNIX-domain socket generate an implicit
connection to it, and then we can use the file descriptor to read and/or
write to it. That way cat ~/my-unix-domain-socket.sock and various other
programs that are only file aware will work.
I suppose there isn't anything in the POSIX standard that allows it, but
it would be a nice hack.
Regards,
Shlomi Fish
----------------------------------------------------------------------
Shlomi Fish shlomif@t2.technion.ac.il
Home Page: http://t2.technion.ac.il/~shlomif/
Home E-mail: shlomif@techie.com
A more experienced programmer does not make less bugs. He just realizes
what went wrong more quickly.
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il