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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f69eb259f3ed2afb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: "markp" Newsgroups: comp.lang.ada Subject: Re: Using GNAT.Sockets Date: 18 Apr 2005 02:01:07 -0700 Organization: http://groups.google.com Message-ID: <1113814867.251847.285880@o13g2000cwo.googlegroups.com> References: <1113404846.310840.322920@z14g2000cwz.googlegroups.com> <1113555847.303640.190000@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 208.20.220.69 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1113814871 31072 127.0.0.1 (18 Apr 2005 09:01:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 18 Apr 2005 09:01:11 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=208.20.220.69; posting-account=_Inhcg0AAAAPC2BsuUqoGG-atarvM4_J Xref: g2news1.google.com comp.lang.ada:10518 Date: 2005-04-18T02:01:07-07:00 List-Id: Duncan Sands wrote: > Hi markp, > > > Thanks for your reply. In case (1), that is what is occuring. When I > > call Receive_Socket again to get the rest of the data, I'm wondering if > > the call will place the new data at the beginning of the item buffer. > > That would mean I would have to copy it out before I do a subsequent > > read. Is this the case? > > Suppose your buffer is My_Buffer, and after the first call you see > Last < My_Buffer'Last (note that if Last < My_Buffer'First then the > connection has gone down). Then you can do the following: > > procedure Receive_Socket > (Socket => My_Socket, > Item => My_Buffer (Last + 1 .. My_Buffer'Last), > Last => Last); > > > I do not want a higher level routine. I would like to stay withing the > > GNAT.Sockets package. > > GNAT.Sockets provides higher level routines - the stream stuff. > > Ciao, > > Duncan. Duncan, Thanks for your reply. It does what I want it to do. I have one other question. My assumption is that I have to read the data into My_buffer, which is of a type Stream_Elemet_Array. If there a way to read the data directly into an Ada record type, as opposed to a Stream_Element_Array? Otherwise, I will have to read the socket and then copy the bytes into the record type and act on it there. Is there a way to avoid this extra copy and go directly to my data type? Thanks once again for your help, Mark