<a href="https://gunkies.org/wiki/4.1_BSD" rel="nofollow">https://gunkies.org/wiki/4.1_BSD</a> says 01981. I was wrong; 3BSD in 01979 did <i>not</i> have sockets, and neither did 4BSD in 01980. Joy and Fabry's proposal to DARPA in August 01981 <a href="https://www.jslite.net/notes/joy2.pdf" rel="nofollow">https://www.jslite.net/notes/joy2.pdf</a> proposes:<p>> <i>Initially we intend to add the facilities described here to UNIX. We will then begin to implement portions of UNIX itself using the IPC [inter-process communication] as an implementation tool. This will involve layering structure on top of the IPC facilities. The eventual result will be a distributed UNIX kernel based on the IPC framework.</i><p>> <i>The IPC mechanism is based on an abstraction of a space of communicating entities communicating through one or more</i> sockets. <i>Each socket has a</i> type <i>and an</i> address. <i>Information is transmitted between sockets by</i> send <i>and</i> receive <i>operations. Sockets of specific</i> type <i>may provide other</i> control <i>operations related to the specific protocol of the</i> socket.<p>They did deliver sockets more or less as described in 4.1BSD later that year, but distributing the Unix kernel never materialized. The closest thing was what Joy would later bring about at Sun, NFS and YP (later NIS). They clarify that they had a prototype working already:<p>> <i>A more complete description of the IPC architecture described here, measurements of a prototype implementation, comparisons with other work and a complete bibliography are given in CSRG TR/3: "An IPC Architecture for UNIX."</i><p>And they give a definition for struct in_addr, though not today's definition. Similarly they use SOCK_DG and SOCK_VC rather than today's SOCK_DGRAM and SOCK_STREAM, offering this sample bit of source:<p><pre><code> s = socket(SOCK_DG, &addr, &pref);
</code></pre>
CSRG TR/3 does not seem to have been promoted to an EECS TR, because I cannot find anything similar in <a href="https://www2.eecs.berkeley.edu/Pubs/TechRpts/" rel="nofollow">https://www2.eecs.berkeley.edu/Pubs/TechRpts/</a>. And they evidently didn't check their "prototype" socket implementation in to source control until November 01981: <a href="https://github.com/robohack/ucb-csrg-bsd/commit/9a54bb7a2aa04963b48d282d19799cc163924d52" rel="nofollow">https://github.com/robohack/ucb-csrg-bsd/commit/9a54bb7a2aa0...</a><p>In theory that's four months <i>after</i> the 4.1BSD release in <a href="http://bitsavers.trailing-edge.com/bits/UCB_CSRG/4.1_BSD_19810710.zip" rel="nofollow">http://bitsavers.trailing-edge.com/bits/UCB_CSRG/4.1_BSD_198...</a>, linked from <a href="https://gunkies.org/wiki/4.1_BSD" rel="nofollow">https://gunkies.org/wiki/4.1_BSD</a>, which does seem to have sockets in some minimal form. I don't understand the tape image format, but the string "socket" occurs: "Protocol wrong type for socket^@Protocol not available^@Protocol not supported^@Socket type not supported^@Operation not supported on socket^@Protocol family not supported^@Address family not supported by protocol family^@Address already in use^@Can't assign requested address^@".<p>This is presumably compiled from lib/libc/gen/errlst.c or its moral equivalent (e.g., there was an earlier version that was part of the ex editor source code). But those messages were not added to the checked-in version of that file until Charlie Root checked in "get rid of mpx stuff" in February of 01982: <a href="https://github.com/robohack/ucb-csrg-bsd/commit/96df46d726420d755c66eec3157ed23ba5f5bb7e" rel="nofollow">https://github.com/robohack/ucb-csrg-bsd/commit/96df46d72642...</a><p>The 4.1 tape image I linked above does not contain man pages for sockets. Evidently those weren't added until 4.2! The file listings in burst/00002.txt mention finger and biff, but those could have been non-networked versions (although Finger was a documented service on the ARPANet for several years at that point, with no sign of growing into a networked hypertext platform with mobile code). Delivermail, the predecessor of sendmail, evidently had cmd/delivermail/arpa-mailer.8, cmd/delivermail/arpa.c, etc.<p>That release was actually the month <i>before</i> Joy and Fabry's proposal, so perhaps sockets were still a "prototype" in that release?<p>The current sockaddr_in structure was checked in to source control as a patch to sys/netinet/in.h on November 18, 01981: <a href="https://github.com/robohack/ucb-csrg-bsd/commit/b5bb9400a15e83453dc508408c62416ea99fc#diff-4fa5c1dd5ee97f24039403265bed7553f70c78a611fd224cd1b3566a002251ac" rel="nofollow">https://github.com/robohack/ucb-csrg-bsd/commit/b5bb9400a15e...</a><p>Kirk McCusick's "Twenty Years of Berkeley Unix" <a href="https://www.oreilly.com/openbook/opensources/book/kirkmck.html" rel="nofollow">https://www.oreilly.com/openbook/opensources/book/kirkmck.ht...</a> says:<p>> <i>When Rob Gurwitz released an early implementation of the TCP/IP protocols to Berkeley, Joy integrated it into the system and tuned its performance. During this work, it became clear to Joy and Leffler that the new system would need to provide support for more than just the DARPA standard network protocols. Thus, they redesigned the internal structuring of the software, refining the interfaces so that multiple network protocols could be used simultaneously.</i><p>> <i>With the internal restructuring completed and the TCP/IP protocols integrated with the prototype IPC facilities, several simple applications were created to provide local users access to remote resources. These programs, rcp, rsh, rlogin, and rwho were intended to be temporary tools that would eventually be replaced by more reasonable facilities (hence the use of the distinguishing "r" prefix). This system, called 4.1a, was first distributed in April 1982 for local use; it was never intended that it would have wide circulation, though bootleg copies of the system proliferated as sites grew impatient waiting for the 4.2 release.</i><p>rcmd, rexec, rsh, rlogin, and rlogind were checked into SCCS on April 2, 01982. At first glance, this socket code looks like it would compile today: <a href="https://github.com/robohack/ucb-csrg-bsd/commit/58a2fc8197d006d9c22596cde9d5f98019798dd8" rel="nofollow">https://github.com/robohack/ucb-csrg-bsd/commit/58a2fc8197d0...</a><p>Telnet, also using sockets, had been checked in earlier on February 28: <a href="https://github.com/robohack/ucb-csrg-bsd/commit/0dd802d6a649b128462543d7665ecd03d993aa4f" rel="nofollow">https://github.com/robohack/ucb-csrg-bsd/commit/0dd802d6a649...</a>