From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95cb9cc00d809d62 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-05 08:54:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: wojtek@power.com.pl (Wojtek Narczynski) Newsgroups: comp.lang.ada Subject: Re: Reading a C record from socket - chicken / egg problem Date: 5 Dec 2002 08:54:54 -0800 Organization: http://groups.google.com/ Message-ID: <5ad0dd8a.0212050854.264f8f25@posting.google.com> References: <5ad0dd8a.0211230443.4b476252@posting.google.com> NNTP-Posting-Host: 217.98.138.16 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1039107295 31207 127.0.0.1 (5 Dec 2002 16:54:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 5 Dec 2002 16:54:55 GMT Xref: archiver1.google.com comp.lang.ada:31466 Date: 2002-12-05T16:54:55+00:00 List-Id: > Declare a structure corresponding to the fields version .. reserved > inclusive (use Interfaces.C.unsigned_char). and read it from the socket. > > Calculate the actual contentLength and paddingLength. > > Use a declare block: > > declare > type content is array (1 .. contentLength) of Interfaces.C.unsigned_char; > type padding is array (1 .. paddingLength) of Interfaces.C.unsigned_char; > type remainder is record > c : content; > p : padding; > end record; > r : remainder; > begin > -- read r from the socket and process it > end; > > I know this means doing 2 reads but that's the minimum. Looks like this is not enough, because content should be read to heap while padding should be read to stack. This adds another read. I must take a good look at how this all is done in the original C code... Regards, Wojtek