Creating a socket with ISC's libinet.a

Eric Gisin eric at mks.com
Tue Jan 16 12:18:59 AEST 1990


In article <403 at zok.UUCP>, mark at zok.UUCP (Mark W. Snitily) writes:
> Has anyone tried to create a socket using the libinet.a that comes
> with ISC's X11 development package?
> 
> ... [deleted]
> I've tried every combination of format (e.g. AF_INET) and type (e.g.
> SOCK_STREAM) and the socket() call always returns -1 (meaning error).
> 
> ISC's X11 server appears to open a Unix domain socket (AF_UNIX with
> /tmp/.X11-unix/X0).
> 
> I don't have ISC's TCP/IP package, only the libinet.a library that comes
> with the X11 libraries.
> 
> Does anyone know how to create and use a socket with this library?
> 

The -linet routines emulate BSD sockets by using the native stream
devices and system calls in System V.
socket(AF_INET, SOCK_STREAM) looks up it parameters in /etc/socket.conf,
which tells socket to open /dev/tcp and push the "socket" module.
So if you don't have the tcp/ip package,
you won't have /dev/tcp and can't use socket().

Your basic misconception is that /dev/.X11-unix/0 is a UNIX domain socket.
The socket emulation does NOT implemement AF_UNIX.
/dev/.X11-unix/0 is one end of a Stream pipe.
This allows X11 to work without the tcp/ip package,
it uses just the basic streams package.

I figured all this out while trying to decide what it would
take to build X11.4 on 386/IX.  It looks like you could
easily build it with either socket emulation or native streams.
But you would only get tcp based connections, not local connections.
Has anyone reverse engineered the local connection code
that Interactive uses? It is different that the scheme
ATT uses in lib/X/XStream.c.  Interactive uses /dev/spx,
while ATT uses /dev/ptmx. Are either of these devices documented?



More information about the Comp.unix.i386 mailing list