The attached source code is almost directly pasted from the comments in GNAT.Sockets, just added a loop. The behaviour is what one could call undefined, it either crashes with a memory access volation, produces no output, or produces a fragment of the correct output, depending on what you send. I used a telnet client to connect to the socket. It seems always to crash when I type "aa/newline/aaa". I tried with two different versions of GCC I have, the result is the same.
My system is Aurox Linux 9.2 based on Red Hat 9.0 on Athlon XP 1700+ (i686) # gcc -v Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs Configured with: /root/src/gcc-3.3.3/configure --enable-threads=posix --enable-shared --with-system-zlib Thread model: posix gcc version 3.3.3 switches used: gcc -c test.adb # gcc-3.4 -v Reading specs from /usr/local/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: /root/src/gcc-3.4.0/configure --program-suffix=-3.4 --enable-threads=gnat --enable-languages=c,c++,ada --enable-version-specific-runtime-libs : (reconfigured) /root/src/gcc-3.4.0/configure --prefix=/usr/local/gcc-3.4 --program-suffix=-3.4 --enable-threads=gnat --enable-languages=c,ada --enable-version-specific-runtime-libs Thread model: gnat gcc version 3.4.0 switches used: gcc-3.4 -c -g -gnato -gnatf -gnatE -gnatwl -I/usr/local/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.0/adainclude test.adb gnatbind-3.4 -aO./ -aO/usr/local/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib -aI/usr/local/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.0/adainclude -I- -x test.ali gnatlink-3.4 test.ali -g --GCC=gcc-3.4 --LINK=gcc-3.4 ------------------------------------------------------------------------------- file: test.adb ------------------------------------------------------------------------------- with GNAT.Sockets, Ada.Text_IO; use GNAT.Sockets; procedure Test is Address : Sock_Addr_Type; Server : Socket_Type; Socket : Socket_Type; Channel : Stream_Access; begin Initialize; Address.Addr := Addresses (Get_Host_By_Name (Host_Name), 1); Address.Port := 5876; Create_Socket (Server); Set_Socket_Option (Server, Socket_Level, (Reuse_Address, True)); Bind_Socket (Server, Address); Listen_Socket (Server); Accept_Socket (Server, Socket, Address); Channel := Stream (Socket); delay 0.2; loop declare Message : String := String'Input (Channel); begin Ada.Text_IO.Put_Line (Message); end; end loop; Close_Socket (Server); Close_Socket (Socket); end; -- Summary: GNAT.Sockets Stream feature not working properly Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kat-zygfryd at o2 dot pl CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17960