From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: Finding the end of a stream from a socket
Date: Sat, 21 Oct 2017 14:11:43 -0400
Date: 2017-10-21T14:11:43-04:00 [thread overview]
Message-ID: <783nuc1ap2d5dqbuqgimm6igket7ecjeo9@4ax.com> (raw)
In-Reply-To: 9e50578f-d646-4b86-88f9-68a123959ea1@googlegroups.com
On Sat, 21 Oct 2017 06:45:22 -0700 (PDT), Andrew Shvets
<andrew.shvets@gmail.com> declaimed the following:
>
>
> loop
> begin
> GNAT.Sockets.Receive_Socket(Receiver, Buffer, Last);
>
> -- the connection was reset by peer.
> exit when Last < Buffer'First;
>
> for Octet in Buffer'First .. Last loop
> Ada.Text_IO.Put(Character'Val(Buffer(Octet)));
> end loop;
> exception
> when Ada.IO_Exceptions.End_Error =>
> Ada.Text_IO.Put_Line(Ada.Text_IO.Standard_Error, " ERROR: Issue encountered while receiving data from user.");
> end;
> end loop;
>
>
>I get the following error when I make the Receive_Socket procedure call:
>
>raised GNAT.SOCKETS.SOCKET_ERROR : [107] Transport endpoint is not connected
> 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.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
next prev parent reply other threads:[~2017-10-21 18:11 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 [this message]
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
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