comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Love <rblove@airmail.net>
Subject: Re: Gnat Sockets & Streams
Date: Sat, 15 Sep 2012 12:26:20 -0500
Date: 2012-09-15T12:26:20-05:00	[thread overview]
Message-ID: <2012091512262096135-rblove@airmailnet> (raw)
In-Reply-To: m2vcffkymt.fsf@pushface.org

On 2012-09-15 17:02:34 +0000, Simon Wright said:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
> (from bitter experience communicating with many different device
> types/protocols)
> 
>> Using streams and sockets you should remember:
>> 
>> 1. Stream attributes are not portable. The only type you should read/write
>> into the socket stream is Unsigned_8 or equivalent (octet).
> 
> But you are not likely to have much trouble if you use the same
> compiler, and ideally the same version, on either side.
> 
>> 2. As with any I/O you should honestly implement all layers of the protocol
>> at hand. Don't try shortcuts like stream type attributes, representation
>> clauses etc.
> 
> The stream type attributes may well be OK, and (as above) if you have
> the same compiler either end you will probably be OK. It's quite another
> matter if your Ada has to talk to someone else's C.

This is my situation.  My Ada has to talk to Python or C.


> 
>> 3. Network protocols are packet-oriented. You have to use Write (of the
>> type Root_Stream_Type) instead of attributes to ensure that the packet is
>> sent as a whole. It matters for both UDP and TCP/IP.
> 
> This is SO TRUE for UDP. I've never used multicast but anywhere there
> are datagrams you need to heed this!
> 
> The approach we adopted was to use a memory stream (eg [1]) and then use
> Write on the resulting Stream_Element_Array.


I'm not sure I want to adopt the Booch Components just to get a packet 
sent correctly.

Thanks to all for your comments.


> 
> Not sure why it would matter for TCP? (unless you've used TCP_NO_DELAY,
> of course).
> 
> [1] 
> http://booch95.svn.sourceforge.net/viewvc/booch95/trunk/src/bc-support-memory_streams.ads?revision=1420&view=markup 
> 





  reply	other threads:[~2012-09-15 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-15  2:01 Gnat Sockets & Streams Robert Love
2012-09-15  7:28 ` Simon Wright
2012-09-15 23:14   ` Simon Wright
2012-09-15  7:52 ` Dmitry A. Kazakov
2012-09-15 17:02   ` Simon Wright
2012-09-15 17:26     ` Robert Love [this message]
2012-09-15 18:17     ` Dmitry A. Kazakov
2012-09-15 19:27       ` Simon Wright
2012-09-16 13:38 ` gautier_niouzes
replies disabled

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