From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!XkhLYGh9FeaGRJtDGav81g.user.46.165.242.75.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Sockets, Streams, and Element_Arrays: Much confusion Date: Sun, 01 Jan 2023 16:11:22 +0000 Organization: Aioe.org NNTP Server Message-ID: References: <6183be57-2796-0ab7-739f-a5b557083ee6@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: gioia.aioe.org; logging-data="13882"; posting-host="XkhLYGh9FeaGRJtDGav81g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:CzDLZv6BIu7FmKZB1Pa2qgpjPVQ= Xref: reader01.eternal-september.org comp.lang.ada:64763 List-Id: "Dmitry A. Kazakov" writes: > Well decoding NTP query from Stream_Element_Array takes 2 statements > (extracting two big-endian 32-bit numbers). You can check the > implementation here: > > http://www.dmitry-kazakov.de/ada/components.htm#17.17 > > which is under-zero brained (:-)) compared to dealing with definition > of record layout and bit orders you suggest. It's obviously OK to use just the fields of interest in the received packet. But this strikes me as something I would have questioned at review: Data : Stream_Element_Array (1..NTP_Packet_Size) := ( 1 => 2#1110_0011#, -- LI, Version, Mode 2 => 0, -- Stratum, or type of clock 3 => 0, -- Polling Interval 4 => 16#EC#, -- Peer Clock Precision 13 => 49, 14 => 16#4E#, 15 => 49, 16 => 52, others => 0 );