From 247d360004a712e797f21f2440ac755f6713305f Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 13:50:06 +0200 Subject: [PATCH 1/7] fix(applications): use updated socketAPI terminology Signed-off-by: Walentalien --- applications/anatomy.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/applications/anatomy.rst b/applications/anatomy.rst index ba5185a..68cf30c 100644 --- a/applications/anatomy.rst +++ b/applications/anatomy.rst @@ -85,19 +85,19 @@ operation: The reason that this operation takes three arguments is that the socket interface was designed to be general enough to support any underlying protocol suite. Specifically, the ``domain`` argument specifies the -protocol *family* that is going to be used: ``PF_INET`` denotes the -Internet family, ``PF_UNIX`` denotes the Unix pipe facility, and -``PF_PACKET`` denotes direct access to the network interface (i.e., it -bypasses the TCP/IP protocol stack). The ``type`` argument indicates the -semantics of the communication. ``SOCK_STREAM`` is used to denote a byte -stream. ``SOCK_DGRAM`` is an alternative that denotes a message-oriented -service, such as that provided by UDP. The ``protocol`` argument -identifies the specific protocol that is going to be used. In our case, -this argument is ``UNSPEC`` because the combination of ``PF_INET`` and -``SOCK_STREAM`` implies TCP. Finally, the return value from ``socket`` -is a *handle* for the newly created socket—that is, an identifier by -which we can refer to the socket in the future. It is given as an -argument to subsequent operations on this socket. +protocol *family* that is going to be used: ``AF_INET`` denotes the +IPv4 Internet family, ``AF_UNIX`` denotes the Unix-domain socket family +for communication between local processes, and ``AF_PACKET`` provides +low-level access to packets at the network-device level. The ``type`` +argument indicates the semantics of the communication. ``SOCK_STREAM`` +is used to denote a byte stream. ``SOCK_DGRAM`` is an alternative that +denotes a message-oriented service, such as that provided by UDP. The +``protocol`` argument identifies the specific protocol that is going to +be used. In our case, this argument is ``0`` because the combination +of ``AF_INET`` and ``SOCK_STREAM`` selects TCP. Finally, the return +value from ``socket`` is a *handle* for the newly created socket—that +is, an identifier by which we can refer to the socket in the future. +It is given as an argument to subsequent operations on this socket. The next step depends on whether you are a client or a server. On a server machine, the application process performs a *passive* open—the From 8ec5897554c3d94e1d92e3872a4abf7673bb6a54 Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 14:02:06 +0200 Subject: [PATCH 2/7] fix(resources): use AF_INET Signed-off-by: Walentalien --- resources/code/simplex-client.c | 2 +- resources/code/simplex-server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/code/simplex-client.c b/resources/code/simplex-client.c index 16321c1..374226a 100644 --- a/resources/code/simplex-client.c +++ b/resources/code/simplex-client.c @@ -48,7 +48,7 @@ main(int argc, char *argv[]) sin.sin_port = htons(SERVER_PORT); /* active open */ - if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("socket"); exit(1); } diff --git a/resources/code/simplex-server.c b/resources/code/simplex-server.c index b0fcf15..17e2299 100644 --- a/resources/code/simplex-server.c +++ b/resources/code/simplex-server.c @@ -39,7 +39,7 @@ main(int argc, char *argv[]) sin.sin_port = htons(SERVER_PORT); /* setup passive open */ - if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("socket"); exit(1); } From 88c96ae1d166fe6ff04edf96784ab60c438ab006 Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 14:04:00 +0200 Subject: [PATCH 3/7] fix wording Signed-off-by: Walentalien --- applications/anatomy.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/anatomy.rst b/applications/anatomy.rst index 68cf30c..1b95dda 100644 --- a/applications/anatomy.rst +++ b/applications/anatomy.rst @@ -85,7 +85,7 @@ operation: The reason that this operation takes three arguments is that the socket interface was designed to be general enough to support any underlying protocol suite. Specifically, the ``domain`` argument specifies the -protocol *family* that is going to be used: ``AF_INET`` denotes the +address *family* that is going to be used: ``AF_INET`` denotes the IPv4 Internet family, ``AF_UNIX`` denotes the Unix-domain socket family for communication between local processes, and ``AF_PACKET`` provides low-level access to packets at the network-device level. The ``type`` From 34a380d4e31e0e0f8b11e2fc3811c8e2a5b49829 Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 14:13:40 +0200 Subject: [PATCH 4/7] align terminilogy with socket(2) Signed-off-by: Walentalien --- applications/anatomy.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/anatomy.rst b/applications/anatomy.rst index 1b95dda..586635a 100644 --- a/applications/anatomy.rst +++ b/applications/anatomy.rst @@ -85,7 +85,7 @@ operation: The reason that this operation takes three arguments is that the socket interface was designed to be general enough to support any underlying protocol suite. Specifically, the ``domain`` argument specifies the -address *family* that is going to be used: ``AF_INET`` denotes the +communication domain that is going to be used: ``AF_INET`` denotes the IPv4 Internet family, ``AF_UNIX`` denotes the Unix-domain socket family for communication between local processes, and ``AF_PACKET`` provides low-level access to packets at the network-device level. The ``type`` From a7aaf5614a9c2f93532cc09c939d11ca90cb0e47 Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 14:21:01 +0200 Subject: [PATCH 5/7] improve wording Signed-off-by: Walentalien --- applications/anatomy.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/anatomy.rst b/applications/anatomy.rst index 586635a..d57b8ce 100644 --- a/applications/anatomy.rst +++ b/applications/anatomy.rst @@ -93,8 +93,8 @@ argument indicates the semantics of the communication. ``SOCK_STREAM`` is used to denote a byte stream. ``SOCK_DGRAM`` is an alternative that denotes a message-oriented service, such as that provided by UDP. The ``protocol`` argument identifies the specific protocol that is going to -be used. In our case, this argument is ``0`` because the combination -of ``AF_INET`` and ``SOCK_STREAM`` selects TCP. Finally, the return +be used. In our case, this argument is ``0``, which selects TCP as the default +protocol for the ``AF_INET`` and ``SOCK_STREAM`` combination. Finally, the return value from ``socket`` is a *handle* for the newly created socket—that is, an identifier by which we can refer to the socket in the future. It is given as an argument to subsequent operations on this socket. From 4284d6313a6d8c6004b4e97aada43b5cdc4ed3f4 Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 14:27:27 +0200 Subject: [PATCH 6/7] fix Signed-off-by: Walentalien --- applications/anatomy.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/anatomy.rst b/applications/anatomy.rst index d57b8ce..d919277 100644 --- a/applications/anatomy.rst +++ b/applications/anatomy.rst @@ -93,10 +93,10 @@ argument indicates the semantics of the communication. ``SOCK_STREAM`` is used to denote a byte stream. ``SOCK_DGRAM`` is an alternative that denotes a message-oriented service, such as that provided by UDP. The ``protocol`` argument identifies the specific protocol that is going to -be used. In our case, this argument is ``0``, which selects TCP as the default -protocol for the ``AF_INET`` and ``SOCK_STREAM`` combination. Finally, the return -value from ``socket`` is a *handle* for the newly created socket—that -is, an identifier by which we can refer to the socket in the future. +be used. In our case, this argument is ``0``, which selects TCP as the +default protocol for the ``AF_INET`` and ``SOCK_STREAM`` combination. +Finally, the return value from ``socket`` is a *handle* for the newly +created socket—that is, an identifier by which we can refer to the socket in the future. It is given as an argument to subsequent operations on this socket. The next step depends on whether you are a client or a server. On a From 1bb332b8495933281875b8a12e54a488f9c508ca Mon Sep 17 00:00:00 2001 From: Walentalien Date: Tue, 29 Sep 2026 14:31:49 +0200 Subject: [PATCH 7/7] fix lint Signed-off-by: Walentalien --- applications/anatomy.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/anatomy.rst b/applications/anatomy.rst index d919277..a93ec79 100644 --- a/applications/anatomy.rst +++ b/applications/anatomy.rst @@ -95,8 +95,9 @@ denotes a message-oriented service, such as that provided by UDP. The ``protocol`` argument identifies the specific protocol that is going to be used. In our case, this argument is ``0``, which selects TCP as the default protocol for the ``AF_INET`` and ``SOCK_STREAM`` combination. -Finally, the return value from ``socket`` is a *handle* for the newly -created socket—that is, an identifier by which we can refer to the socket in the future. +Finally, the return value from ``socket`` is a *handle* for the newly +created socket—that is, an identifier by which we can refer to the +socket in the future. It is given as an argument to subsequent operations on this socket. The next step depends on whether you are a client or a server. On a