comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Ada x <whatever> Datagram Sockets
Date: Thu, 07 Feb 2019 10:08:48 +0000
Date: 2019-02-07T10:08:48+00:00	[thread overview]
Message-ID: <lypns3ykpb.fsf@pushface.org> (raw)
In-Reply-To: q3gq7i$o27$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> Well, using streams directly with UDP is calling for trouble (and
> highly non-portable too). You should probably never use streams with
> TCP either. Certainly not if socket options like NO_DELAY are
> planned.

The reason for this is to be found in ARM 13.13.2(9)[1] for 'Write:

   For composite types, the Write or Read attribute for each component
   is called in canonical order

which will result in multiple calls to the underlying OS services; bad
for TCP_NODELAY, very very bad for UDP.

See GCC PR9535[2]. Note, the change applied really doesn't address the
problem at all, in spite of being essentially my patch! I lost interest,
having already decided to do as Dmitry says ...

> Anyway, the way to do it is to have an outgoing packet buffer of
> Stream_Element_Array. You put data there and then send all buffer to
> the socket (write to the file etc), in one piece.
>
> If you want to use streams. Put a memory-mapped stream on top of the
> Stream_Element_Array. Write packet whole. Flush the buffer contents to
> the socket/file.

... see, in particular, comments 2, 6 in [2].

[1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-13-13-2.html#p9
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=9535

  reply	other threads:[~2019-02-07 10:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 23:10 Ada x <whatever> Datagram Sockets Rego, P.
2019-02-07  0:42 ` Jere
2019-02-07  5:28   ` Rego, P.
2019-02-07  6:00     ` Egil H H
2019-02-07  6:41       ` Rego, P.
2019-02-07  7:23         ` Egil H H
2019-02-07 11:48           ` Jere
2019-02-08 19:41           ` Rego, P.
2019-02-08 20:31             ` Dmitry A. Kazakov
2019-02-08 21:56               ` Rego, P.
2019-02-07  8:28         ` Dmitry A. Kazakov
2019-02-07 10:08           ` Simon Wright [this message]
2019-02-08  0:15           ` Randy Brukardt
2019-02-08  8:25             ` Simon Wright
2019-02-08 13:24               ` Dmitry A. Kazakov
2019-02-09  1:01               ` Randy Brukardt
2019-02-10 17:54                 ` Simon Wright
2019-02-11  8:39                   ` Dmitry A. Kazakov
2019-02-11 13:35                     ` Simon Wright
2019-02-11 14:25                       ` Dmitry A. Kazakov
2019-02-11 15:19                         ` Simon Wright
2019-02-11 16:04                           ` Dmitry A. Kazakov
2019-02-11 23:19                   ` Randy Brukardt
2019-02-12 11:35                     ` Simon Wright
2019-02-08 19:44           ` Rego, P.
2019-02-07 11:47         ` Jere
2019-02-07 18:00           ` Jeffrey R. Carter
2019-02-08 20:35             ` Rego, P.
2019-02-08 21:26               ` Jeffrey R. Carter
2019-02-08 22:02                 ` Rego, P.
2019-02-08 21:38               ` Dmitry A. Kazakov
2019-02-08 20:00           ` Rego, P.
2019-02-07 10:11     ` Simon Wright
2019-02-08 20:03       ` Rego, P.
replies disabled

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