[comp.protocols.tcp-ip] What is a UNIX Domain Socket?

lance@unigold.UUCP (Lance Ellinghouse) (09/22/90)

Ok, I know this is a dumb question..

What exactly is a Unix Domain Socket?
What makes it different from a INET Socket?

Thanks,

+----------------------------------------------+------------------------------+
|Lance Ellinghouse                             |Any ideas on what to put here?|
|E-mail: lance@unigold.uucp                    |I have no idea... :)          |
|        unigold!lance@srhqla.sr.com           |                              |
|        hermix!unigold!lance@anes.ucla.edu    +------------------------------+
|USnail Mail: UNIGOLD, 16311 Ventura Blvd. Suite 1100, Encino, Ca, 91436      |
+-----------------------------------------------------------------------------+

harvey@dg-rtp.dg.com (Michael Harvey) (09/28/90)

In article <82@unigold.UUCP>, lance@unigold.UUCP (Lance Ellinghouse) writes:
|> Ok, I know this is a dumb question..
|> 
|> What exactly is a Unix Domain Socket?
|> What makes it different from a INET Socket?
|>
A socket is simply a communication endpoint. 
Sockets support two communications domains: the UNIX domain
for process-to-process communication on the same host,
and the Internet domain for process-to-process communication
between hosts that communicate with one another using the
DARPA standard communication protocols, such as IP, TCP, and UDP.

In the UNIX domain, socket names are UNIX pathnames;
for example, a socket may be named /tmp/foo.
Naming sockets in the Internet domain involve concatenating
the Internet address with a port number.

I think that covers the basics.  Comments?

rpw3@rigden.wpd.sgi.com (Rob Warnock) (09/28/90)

In article <1990Sep27.180632.25841@dg-rtp.dg.com> harvey@dg-rtp.dg.com
(Michael Harvey) writes:
+---------------
| Sockets support two communications domains: the UNIX domain
| for process-to-process communication on the same host,
| and the Internet domain for process-to-process communication
| between hosts that communicate with one another using the
| DARPA standard communication protocols, such as IP, TCP, and UDP.
+---------------

The [Berkeley] socket model supports an arbitrary number of domains.
Let's not forget the XNS domain (Xerox NS), which uses Xerox standard
protocols (ITP, Courier, Clearinghouse), or the XTP domain (Protocol
Engines Inc.'s protocol), or VMTP, or whatever...

...even if AF_INET *is* the most common.


-Rob

-----
Rob Warnock, MS-9U/510		rpw3@sgi.com		rpw3@pei.com
Silicon Graphics, Inc.		(415)335-1673		Protocol Engines, Inc.
2011 N. Shoreline Blvd.
Mountain View, CA  94039-7311

pcg@cs.aber.ac.uk (Piercarlo Grandi) (10/10/90)

On 27 Sep 90 18:06:32 GMT, harvey@dg-rtp.dg.com (Michael Harvey) said:

harvey> In article <82@unigold.UUCP>, lance@unigold.UUCP (Lance
harvey> Ellinghouse) writes:

lance> Ok, I know this is a dumb question..  What exactly is a Unix
lance> Domain Socket?  What makes it different from a INET Socket?

harvey> A socket is simply a communication endpoint.  Sockets support
harvey> two communications domains: the UNIX domain for
harvey> process-to-process communication on the same host, and the
harvey> Internet domain for process-to-process communication between
harvey> hosts that communicate with one another using the DARPA standard
harvey> communication protocols, such as IP, TCP, and UDP.

harvey> In the UNIX domain, socket names are UNIX pathnames;
harvey> for example, a socket may be named /tmp/foo.
harvey> Naming sockets in the Internet domain involve concatenating
harvey> the Internet address with a port number.

harvey> I think that covers the basics.  Comments?

I think I can do better :-). Under Unix all out-of-address space
communication (except for ptrace(2) and signals) is via file
descriptors; file descriptors have a common interface, based on
read/write readv/writev, and ioctl(), etc..., and a type.

One of the types of a file descriptor is socket; when a file descriptor
is a socket, it is attached using a full duplex channel to another
socket file descriptor somewhere.

Socket file descriptors have a number of properties that normal file
descriptors do not have; among these are the type of communication
(stream, message, etc...), an identifier, two modes of connecting a
socket to another for transmitting data, and whether there is the
possibility to transmit file descriptors over the channel.

Socket file descriptors are supported by a a set of protocol
implementations called a 'domain'; only sockets in the same domain may
be connected.

The UNIX domain is a domain where there is only one socket type, only
one protocol, the pipe protocol, where the only socket type allowed is
stream, where socket identifiers are pathnames in the UNIX filesystem,
and where filedescriptors may be passed thru the communication channel
between two sockets.

By contrast the INET domain supports three socket types (stream,
datagram and raw), a number of protocols, socket identifiers are
internet 32 bit numbers, and filedescriptors may not be passed thru the
channel between two sockets.

Many other domains exist.

In the original 4.2BSD design it was to be possible to have user
processes implement domains, by putting the protocol code in the user
process, and having all communications between two sockets in that user
domain be interepted by the user process implementing that domain.

This is still possible by using the UNIX domain, even if in a contrived
way (in particular it is not possible to support other than stream
sockets), by having users for that domain connect in the UNIX domain to
the user implemented domain server, that would return a socket in that
domain (actually a socket to itself, usually, in the UNIX domain).
--
Piercarlo "Peter" Grandi           | ARPA: pcg%uk.ac.aber.cs@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcsun!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk