comp.lang.ada
 help / color / mirror / Atom feed
From: "fabio de francesco" <fmdf@tiscali.it>
Subject: Re: TCP/IP Sockets with GNAT.Sockets
Date: 2 May 2005 13:37:41 -0700
Date: 2005-05-02T13:37:41-07:00	[thread overview]
Message-ID: <1115066261.409185.133090@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: <427671d4$0$166$edfadb0f@dread11.news.tele.dk>

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




  parent reply	other threads:[~2005-05-02 20:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-02  2:42 TCP/IP Sockets with GNAT.Sockets fabio de francesco
2005-05-02  5:58 ` Eric Jacoboni
2005-05-02 12:11 ` Adrien Plisson
2005-05-02 14:55   ` fabio de francesco
2005-05-02 16:10     ` Adrien Plisson
2005-05-02 17:56       ` Eric Jacoboni
2005-05-02 18:30         ` Poul-Erik Andreasen
2005-05-02 19:10           ` Simon Wright
2005-05-03 13:00             ` Poul-Erik Andreasen
2005-05-03 21:48               ` Simon Wright
2005-05-04  8:01               ` Character'First, ASCII.NUL and others (Was: Re: TCP/IP Sockets with GNAT.Sockets) Adrien Plisson
2005-05-04 13:40                 ` Poul-Erik Andreasen
2005-05-02 20:37           ` fabio de francesco [this message]
2005-05-02 20:52             ` TCP/IP Sockets with GNAT.Sockets Adrien Plisson
2005-05-03 12:04               ` fabio de francesco
2005-05-03 12:22                 ` Adrien Plisson
2005-05-03 13:17             ` Poul-Erik Andreasen
2005-05-02 20:44         ` Adrien Plisson
2005-05-02 22:10           ` Eric Jacoboni
2005-05-02 23:42             ` tmoran
2005-05-02 19:39     ` Björn
2005-05-02 20:22       ` fabio de francesco
2005-05-09  4:03         ` Dave Thompson
replies disabled

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