Larry McVoy wrote:
Decades ago, I tried to make a library that worked
like this and it
was problematic. There are all sorts of setsockopt things that
you sometimes need to set.
I'd love to be wrong on this, if anyone has a working, for all of the
normal use cases, library like this, I'd love to see it.
The DEC's TOPS-20 TCP/IP interface (coded on top of a set of new
system calls that implemented the BBN (original) TCP/IP interface for
TENEX/TOPS-20, since system calls could make system calls) was like
that. BUT the TENEX/TOPS-20 system call to pass a pathname into the
system allowed "attributes" to be appended to paths as
";ATTR[:VALUE]"(*), which was used to determine whether it was an active
(connect) or passive (listen) open.
TCP was implemented as a logical device:
TCP:[LOCAL_HOST][-LOCAL_PORT[#]].[FOREIGN_HOST][-FOREIGN_PORT][;A1..]
For details see:
https://www.rfc-editor.org/ien/ien176.txt
And
http://www.bitsavers.org/pdf/dec/pdp10/TOPS20/V7/JSYS_REFERENCE.MEM.txt
(JSYS is the machine instruction used for system calls)
A full set of attribute keywords at page 3-170 (search text document)
and description of TCP: device as implemented in section 2.4.10
NOTE! The original text file undoubtedly had bare carriage return
characters for overstrikes (bold and underscore).
A feature of this interface is that you can fully specify the
four-tuple of the connection when doing a passive open, which ISTR was
used by FTP (the client listened for a connection on the same local
address and port as the command connection, from the foreign address
and FTP-DATA port of the server, and the PORT command was not necessary.
An even more obscure implementation is in my port of the original
Bell Labs (Holmdel, that is) implementation of SNOBOL4, where I
implemented tcp connections (active only) as /tcp/HOSTNAME/SERVICE[/ATTR]...
where ATTR can be used to set various setsockopts:
http://www.regressive.org/snobol4/csnobol4/curr/doc/snobol4io.1.html
(search for tcp).