From: Andrew Shvets <andrew.shvets@gmail.com>
Subject: Re: Finding the end of a stream from a socket
Date: Sun, 22 Oct 2017 05:28:09 -0700 (PDT)
Date: 2017-10-22T05:28:09-07:00 [thread overview]
Message-ID: <e842733e-9f19-4f31-9d61-3c465037fbf0@googlegroups.com> (raw)
In-Reply-To: <f9a1afdc-00d9-452e-aecf-b51c14cb925e@googlegroups.com>
On Sunday, October 22, 2017 at 8:26:54 AM UTC-4, Andrew Shvets wrote:
> On Saturday, October 21, 2017 at 3:19:36 PM UTC-4, Dmitry A. Kazakov wrote:
> > On 2017-10-21 20:11, Dennis Lee Bieber wrote:
> > > On Sat, 21 Oct 2017 06:45:22 -0700 (PDT), Andrew Shvets
> > > <andr.....@gmail.com> declaimed the following:
> > >
> > >> GNAT.Sockets.Bind_Socket(Receiver, (GNAT.Sockets.Family_Inet, GNAT.Sockets.Inet_Addr("127.0.0.1"), 50000));
> > >> GNAT.Sockets.Listen_Socket(Receiver);
> > >>
> > > From those statements I'm guessing you are trying to set this program
> > > up as a server, and have some other program which will connect to send data
> > > to this one.
> > >
> > >> Ada.Text_IO.Put_Line(" !! TCP Server started !!");
> > >>
> > >> loop
> > >> Ada.Text_IO.Put_Line(" FOO 1");
> > >> GNAT.Sockets.Connect_Socket(Receiver, Client_Addr);
> > >
> > > But here you are saying /this/ program is going to connect to a server
> > > at (undefined) Client_Addr.
> > >
> > > I suspect you really need to be using g.s.Accept_Socket() instead.
> >
> > Also note that Accept_Socket will return another socket. This one you
> > should use for communication.
> >
> > A typical scenario for blocking sockets:
> >
> > loop -- Connection listening
> > Accept_Socket -- Get communication socket
> > Start a new session task with the communication socket
> > end loop;
> >
> > The session task deals with the connection using the socket returned by
> > Accept_Socket. Once the session is complete it closes that socket and
> > terminates.
> >
> > --
> > Regards,
> > Dmitry A. Kazakov
> > http://www.dmitry-kazakov.de
>
> One more question. How do I convert a string to a Stream_Element?
>
>
> This is what I have:
>
> Out_String : constant String := "I like cake!";
> Out_Data : Ada.Streams.Stream_Element_Array(1 .. 12);
> begin
> ...
> for elem in 1 .. Out_Data'Length loop
> Out_Data(Ada.Streams.Stream_Element_Offset(elem)) :=
> Ada.Streams.Stream_Element(Character'Val(Out_String(elem)));
> end loop;
I want to write this out to a receiver?
next prev parent reply other threads:[~2017-10-22 12:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-21 2:05 Finding the end of a stream from a socket Andrew Shvets
2017-10-21 8:44 ` Dmitry A. Kazakov
2017-10-21 13:45 ` Andrew Shvets
2017-10-21 18:11 ` Dennis Lee Bieber
2017-10-21 19:19 ` Dmitry A. Kazakov
2017-10-21 19:46 ` Andrew Shvets
2017-10-22 12:26 ` Andrew Shvets
2017-10-22 12:28 ` Andrew Shvets [this message]
2017-10-22 13:28 ` Dmitry A. Kazakov
2017-10-21 17:34 ` Andrew Shvets
2017-10-21 19:18 ` Andrew Shvets
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox