comp.lang.ada
 help / color / mirror / Atom feed
From: Andrew Shvets <andrew.shvets@gmail.com>
Subject: Re: Finding the end of a stream from a socket
Date: Sat, 21 Oct 2017 12:46:39 -0700 (PDT)
Date: 2017-10-21T12:46:39-07:00	[thread overview]
Message-ID: <3753819f-5fea-4d89-9fc2-5aeece125885@googlegroups.com> (raw)
In-Reply-To: <osg6k3$h1a$1@gioia.aioe.org>

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
> > <and.....@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


Weird, I can't see Dennis' reply in this thread, but I see it in Dmitry's reply.


Anyway, thank you both for your help.  With your help, I figured out what my problem is and my example is working now.


  reply	other threads:[~2017-10-21 19:46 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 [this message]
2017-10-22 12:26         ` Andrew Shvets
2017-10-22 12:28           ` Andrew Shvets
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