comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: Re: UDP networking with Ada
Date: Fri, 08 Mar 2013 07:14:34 -0500
Date: 2013-03-08T07:14:34-05:00	[thread overview]
Message-ID: <58CdnbCaDPK2S6TM4p2dnAA@giganews.com> (raw)
In-Reply-To: <khc1i0$aep$1@speranza.aioe.org>



On 03/08/2013 01:47 AM, anon@att.net wrote:
> Now, most of GNAT's add-on packages like Florist uses TCP. But
> GNAT.Sockets does supports both TCP and UDP protocols. And I do
> have a few examples that uses UDP.
>
>    -- Create an UDP socket and I/O channel
>    Create_Socket ( Server_Socket, Family_Inet, Socket_Datagram ) ;
>    Server_Address := ...
>    Server_Channel := Stream ( Server_Socket, Server_Address ) ;
>
>    --  For data transfer use the attribute "Input" and "Output"
>    Data := Character ' Input ( Server_Channel ) ;
>    Unsigned_32 ' Output ( Server_Channel, Response ) ;
>
>    --  Normal termination
>    Close_Socket ( Server_Socket ) ;

Good to know! I read these comments in the specification:

    type Socket_Type is private;
    --  Sockets are used to implement a reliable bi-directional 
point-to-point,
    --  stream-based connections between hosts.

and just assumed datagram sockets were not supported. That's what I get 
for reading comments, I guess! But now I also see:

    type Mode_Type is (Socket_Stream, Socket_Datagram);
    --  Stream sockets provide connection-oriented byte streams. Datagram
    --  sockets support unreliable connectionless message based 
communication.

So I think I'm good to go.

Thanks.

Peter



  parent reply	other threads:[~2013-03-08 12:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-08  0:50 UDP networking with Ada Peter C. Chapin
2013-03-08  3:46 ` Randy Brukardt
2013-03-08 18:28   ` Tero Koskinen
2013-03-08  6:47 ` anon
2013-03-08  7:50   ` Simon Wright
2013-03-08 12:14   ` Peter C. Chapin [this message]
2013-03-08  8:37 ` Dmitry A. Kazakov
2013-03-08 11:50   ` Simon Wright
2013-03-08 12:12     ` Dmitry A. Kazakov
2013-03-08 12:17       ` Peter C. Chapin
2013-03-08 15:39         ` Dmitry A. Kazakov
2013-03-08  8:58 ` Jacob Sparre Andersen
2013-03-08 11:58 ` Stephen Leake
2013-03-16 22:27 ` Kevin K
replies disabled

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