AF_UNIX domain socket question.
Chris Torek
chris at umcp-cs.UUCP
Wed May 29 19:31:34 AEST 1985
> Can several processes write to a unix-domain stream socket at the
> same time and preserve the 'atomic' nature of each call?
Yes, if you're lucky.
> Should I be using datagram sockets?
Probably.
> Even more important to this discussion, can several processes write
> to a socket without 'connecting' to it? I.E. calling socket and
> binding the descriptor to an existing socket (unix file) then reading/
> writing directly to the socket without calling connect. The reason
> being that I need to server to go into a read wait on a socket
> for data that could come from several processes at different times.
> I'd like to give each process its own socket in the usual way, but
> that means I'd have to go into an accept wait...
(Ignoring the fact that that AF_UNIX SOCK_DGRAMs are connectionless...)
Not true; you can use select to tell you which of the r/w sockets and/or
the original bound socket are ``readable''. Select for reading succeeds
when the accept() system call will not block. This is well-known in
a couple of servers and isn't likely to change....
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at maryland
More information about the Comp.unix.wizards
mailing list