comp.lang.ada
 help / color / mirror / Atom feed
From: Michael Paus <pausnospam@nospamib-paus.com>
Subject: Re: Using GNAT.Sockets
Date: Fri, 15 Apr 2005 13:47:58 +0200
Date: 2005-04-15T13:47:58+02:00	[thread overview]
Message-ID: <d3o9le$cgm$1@online.de> (raw)
In-Reply-To: <1113556017.302630.65980@l41g2000cwc.googlegroups.com>

markp wrote:

> Bob,
> 
> Thanks for your reply. My basic quesion is I realize that a socket read
> will not necessarily return all the data requested. The Receive_Socket
> item input parameter takes and array. Will a subsequent read place data
> at the beginning of the array, meaning I have to copy data out before I
> read again?

Yes it does but you do not have to copy your data. Just have a look at
Duncans example. He told you already how to do it. You just have to call
this in a loop until Last = My_Buffer'Last.

   procedure Receive_Socket
     (Socket => My_Socket,
      Item   => My_Buffer (Last + 1 .. My_Buffer'Last),
      Last   => Last);

The first byte will be stored at the first position of the buffer array
you provide, but in the above example we specify a sub-range of the
whole buffer and so the first element of this is at the index Last + 1
of the whole buffer and this is exactly what you need.

Michael



  reply	other threads:[~2005-04-15 11:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13 15:07 Using GNAT.Sockets markwork66
2005-04-13 15:43 ` Duncan Sands
2005-04-15  9:04   ` markp
2005-04-15  9:25     ` Duncan Sands
2005-04-18  9:01       ` markp
2005-04-18 13:23         ` Michael Paus
2005-04-18 14:32           ` markp
2005-04-18 15:14             ` Adrien Plisson
2005-04-18 15:35               ` markp
2005-04-18 15:48                 ` Adrien Plisson
2005-04-18 17:06                   ` markp
2005-04-18 18:23                     ` markp
2005-04-18 20:45                     ` Eric Jacoboni
2005-04-18 21:30                       ` Pascal Obry
2005-04-18 23:00                         ` Eric Jacoboni
2005-04-19  7:04                           ` Pascal Obry
2005-04-19 17:36                           ` Björn Lundin
2005-04-19 19:08                             ` Eric Jacoboni
2005-04-18 13:51         ` Marc A. Criley
2005-04-14 14:45 ` Bob Spooner
2005-04-15  9:06   ` markp
2005-04-15 11:47     ` Michael Paus [this message]
2005-04-15 14:07       ` Bob Spooner
2005-04-17 15:35         ` Michael Paus
replies disabled

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