comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Question about Streams and UDP sockets using GNAT.Sockets
Date: Tue, 18 Jul 2006 15:58:06 -0500
Date: 2006-07-18T15:58:06-05:00	[thread overview]
Message-ID: <p9udnTKibIIE0yDZnZ2dnUVZ_qednZ2d@megapath.net> (raw)
In-Reply-To: 4i3r3nF215adU1@individual.net

"Alex R. Mosteo" <devnull@mailinator.com> wrote in message
news:4i3r3nF215adU1@individual.net...
...
> I've workarounded this in past versions of GNAT using a direct call to the
> Write procedure in Ada.Streams, though you must use a Stream_Element_Array
> instead of a String. Doing so your array is transferred in a single call
> and packet. (Contrarily to using the 'Write attribute of
> Stream_Element_Array, that will also make a call for every element, which
> is very CPU expensive for large arrays).

If the type you are sending is more complex than a simple array, you
probably should try to use 'Write (Unchecked_Conversion won't necessarily
work on complex types). The best way to do it is to create a buffer stream
type that simply puts the bytes in a Stream_Element_Array. Then use the
direct call to the Write procedure of the socket stream.

We include such a type in Claw for this very reason. (Putting things into
the Clipboard or Registry must be done with a single write, so we have to
get all of the bytes together first.)

                           Randy.

                             Randy





  parent reply	other threads:[~2006-07-18 20:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18  9:41 Question about Streams and UDP sockets using GNAT.Sockets lekktu
2006-07-18  9:55 ` Dmitry A. Kazakov
2006-07-18 10:25   ` Alex R. Mosteo
2006-07-18 11:02     ` lekktu
2006-07-18 14:25       ` Alex R. Mosteo
2006-07-18 14:58         ` lekktu
2006-07-18 20:52       ` Samuel Tardieu
2006-07-18 20:58     ` Randy Brukardt [this message]
2006-07-19 10:36       ` Alex R. Mosteo
2006-07-19 18:50       ` Simon Wright
2006-07-18 19:07   ` Jeffrey R. Carter
2006-07-18 20:13     ` Dmitry A. Kazakov
2006-07-19  0:32       ` Jeffrey R. Carter
2006-07-19  8:12         ` Dmitry A. Kazakov
2006-07-19 18:59 ` Simon Wright
2006-07-19 20:54   ` lekktu
replies disabled

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