Date: Sat, 22 Nov 2025 16:16:34 +0000 From: Jose Luis Duran <jlduran@FreeBSD.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org Subject: git: 63ddb46c11 - main - handbook/sockets: Update time.nist.gov IP address Message-ID: <6921e1e2.376ff.5b0af6d0@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/doc/commit/?id=63ddb46c110beb2361a1e890e0435086892f6e60 commit 63ddb46c110beb2361a1e890e0435086892f6e60 Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2025-10-30 18:49:30 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2025-11-22 16:10:47 +0000 handbook/sockets: Update time.nist.gov IP address It has not been this IP address since 2012. % drill -x 192.43.244.18 ... this.has.not.been.ntp.server.time.nist.gov.since.2012. Update it to 132.163.96.1. Reviewed by: ziaee Pull Request: https://github.com/freebsd/freebsd-doc/pull/563 --- .../en/books/developers-handbook/sockets/_index.adoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/documentation/content/en/books/developers-handbook/sockets/_index.adoc b/documentation/content/en/books/developers-handbook/sockets/_index.adoc index 95c8b7b814..49249aa3c7 100644 --- a/documentation/content/en/books/developers-handbook/sockets/_index.adoc +++ b/documentation/content/en/books/developers-handbook/sockets/_index.adoc @@ -383,7 +383,7 @@ Now, let us try to fill it out. Let us assume we are trying to write a client for the _daytime_ protocol, which simply states that its server will write a text string representing the current date and time to port 13. We want to use TCP/IP, so we need to specify `AF_INET` in the address family field. `AF_INET` is defined as `2`. -Let us use the IP address of `192.43.244.18`, which is the time server of US federal government (`time.nist.gov`). +Let us use the IP address of `132.163.96.1`, which is the time server of US federal government (`time.nist.gov`). .Specific example of sockaddr_in image::sainfill.png[] @@ -402,7 +402,7 @@ struct in_addr { In addition, `in_addr_t` is a 32-bit integer. -The `192.43.244.18` is just a convenient notation of expressing a 32-bit integer by listing all of its 8-bit bytes, starting with the _most significant_ one. +The `132.163.96.1` is just a convenient notation of expressing a 32-bit integer by listing all of its 8-bit bytes, starting with the _most significant_ one. So far, we have viewed `sockaddr` as an abstraction. Our computer does not store `short` integers as a single 16-bit entity, but as a sequence of 2 bytes. @@ -414,7 +414,7 @@ Suppose we coded something like this: .... sa.sin_family = AF_INET; sa.sin_port = 13; -sa.sin_addr.s_addr = (((((192 << 8) | 43) << 8) | 244) << 8) | 18; +sa.sin_addr.s_addr = (((((132 << 8) | 163) << 8) | 96) << 8) | 1; .... What would the result look like? @@ -485,7 +485,7 @@ One would be to _reverse_ the values in our code: .... sa.sin_family = AF_INET; sa.sin_port = 13 << 8; -sa.sin_addr.s_addr = (((((18 << 8) | 244) << 8) | 43) << 8) | 192; +sa.sin_addr.s_addr = (((((1 << 8) | 96) << 8) | 163) << 8) | 132; .... This will _trick_ our compiler into storing the data in the _network byte order_. @@ -546,7 +546,7 @@ Or it may outright _refuse_ any request for specific code. [[sockets-first-client]] ===== Our First Client -We now know enough to write a very simple client, one that will get current time from `192.43.244.18` and print it to [.filename]#stdout#. +We now know enough to write a very simple client, one that will get current time from `132.163.96.1` and print it to [.filename]#stdout#. [.programlisting] .... @@ -576,7 +576,7 @@ int main() { sa.sin_family = AF_INET; sa.sin_port = htons(13); - sa.sin_addr.s_addr = htonl((((((192 << 8) | 43) << 8) | 244) << 8) | 18); + sa.sin_addr.s_addr = htonl((((((132 << 8) | 163) << 8) | 96) << 8) | 1); if (connect(s, (struct sockaddr *)&sa, sizeof sa) < 0) { perror("connect"); close(s); @@ -1020,7 +1020,7 @@ int main(int argc, char *argv[]) { We now can type a domain name (or an IP address, it works both ways) on the command line, and the program will try to connect to its _daytime_ server. Otherwise, it will still default to `time.nist.gov`. -However, even in this case we will use `gethostbyname` rather than hard coding `192.43.244.18`. +However, even in this case we will use `gethostbyname` rather than hard coding `132.163.96.1`. That way, even if its IP address changes in the future, we will still find it. Since it takes virtually no time to get the time from your local server, you could run daytime twice in a row:help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6921e1e2.376ff.5b0af6d0>
