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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7db5fb0599fd4b76 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: "fabio de francesco" Newsgroups: comp.lang.ada Subject: Re: TCP/IP Sockets with GNAT.Sockets Date: 2 May 2005 13:37:41 -0700 Organization: http://groups.google.com Message-ID: <1115066261.409185.133090@o13g2000cwo.googlegroups.com> References: <1115001752.291144.218410@z14g2000cwz.googlegroups.com> <427618e9$0$7743$ba620e4c@news.skynet.be> <1115045740.838321.306480@g14g2000cwa.googlegroups.com> <42765108$0$22419$ba620e4c@news.skynet.be> <020520051956181888%jaco@neottia.net> <427671d4$0$166$edfadb0f@dread11.news.tele.dk> NNTP-Posting-Host: 80.181.52.213 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1115066265 2335 127.0.0.1 (2 May 2005 20:37:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 2 May 2005 20:37:45 +0000 (UTC) In-Reply-To: <427671d4$0$166$edfadb0f@dread11.news.tele.dk> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=80.181.52.213; posting-account=Lp02jQ0AAABMd3TAghNf0TM2YBZqD_JE Xref: g2news1.google.com comp.lang.ada:10885 Date: 2005-05-02T13:37:41-07:00 List-Id: Poul-Erik Andreasen wrote: > > [...] > > I have, actually i am using it rigth now and i works. however If the > other end of the socket is a C-style server it will probely demand > somthing like the following: How can you know a priori if a remote service is coded in C or Ada or everything else? > > String'Write( Channel, "Hello" & character'first); > > when i read i read characters and stop when i reach character'first. > > Here is a fixed string sulution > > declare > Channel := Stream( Socket ); > Word : string(1.. max_word); > counter : natural := 1 > begin > loop > word(counter) := Character'Input (Channel); > exit when word(counter) = Character'First; > counter := counter + 1; > end loop; > -- her do what you have to do with Word(1..(counter -1)) > end; Is your code reading character by character? If it is I don't think you can use it for designing efficient programs. > BTW my C-couterpart program dosn't seems to have anything against > String'Output( Channel, "Hello" & character'first) ? What I understand from this thread is that T'Output and T'Input add some metadata to the stream. If it is true, communicating programs in other languages must know how to read/write the streams in order to differentiate data from metadata. May be your C-counterpart program contains an algorithm that knows how to do it. Ciao, fabio de francesco