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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,62ab88cac7a1dbb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.86.72 with SMTP id n8mr1247092paz.24.1347729916903; Sat, 15 Sep 2012 10:25:16 -0700 (PDT) Path: t10ni54143300pbh.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.internetamerica!news.posted.internetamerica.POSTED!not-for-mail NNTP-Posting-Date: Sat, 15 Sep 2012 12:25:16 -0500 From: Robert Love Newsgroups: comp.lang.ada Date: Sat, 15 Sep 2012 12:26:20 -0500 Message-ID: <2012091512262096135-rblove@airmailnet> References: <201209142101005065-rblove@airmailnet> <6owmaht6knzo.brd5acsbbu7j$.dlg@40tude.net> MIME-Version: 1.0 Subject: Re: Gnat Sockets & Streams User-Agent: Unison/2.1.9 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 98.194.35.17 X-Trace: sv3-5nTA74dEOxDwWIoGU1fxzZ3gQ9FYkh/BvSvE4YmFgRP1Vknab6nJZzXdBAdN//wtuXOpkvT/PTK2pDN!oQoV8duY9bka+sEQ6w4Wvx7U5B+WxNRNuUTx+wd0hBpqm6fy/wj2IQzlRet3WABJGEX6EkPMlMbm!mQ== X-Complaints-To: abuse@airmail.net X-DMCA-Complaints-To: abuse@airmail.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2962 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: 2012-09-15T12:26:20-05:00 List-Id: On 2012-09-15 17:02:34 +0000, Simon Wright said: > "Dmitry A. Kazakov" 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 >