comp.lang.ada
 help / color / mirror / Atom feed
From: wojtek@power.com.pl (Wojtek Narczynski)
Subject: Re: Reading a C record from socket - chicken / egg problem
Date: 5 Dec 2002 08:54:54 -0800
Date: 2002-12-05T16:54:55+00:00	[thread overview]
Message-ID: <5ad0dd8a.0212050854.264f8f25@posting.google.com> (raw)
In-Reply-To: x7v7kf4kxau.fsf@smaug.pushface.org

> 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



  reply	other threads:[~2002-12-05 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-23 12:43 Reading a C record from socket - chicken / egg problem - now complete Wojtek Narczynski
2002-11-23 14:54 ` Robert A Duff
2002-11-23 17:31 ` Simon Wright
2002-12-05 16:54   ` Wojtek Narczynski [this message]
2002-11-23 18:55 ` SteveD
2002-11-28 21:33 ` Craig Carey
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox