--with Ada.Strings.Unbounded; with Ada.Text_IO; --with Ada.Text_IO.Unbounded_IO; with GNAT.Sockets; procedure Client is --package StrUnbound renames Ada.Strings.Unbounded; package IO renames Ada.Text_IO; -- package UnboundIO renames Ada.Text_IO.Unbounded_IO; package Socket renames GNAT.Sockets; Address : Socket.Sock_Addr_Type; Client_Socket : Socket.Socket_Type; Channel : Socket.Stream_Access; -- UnboundCommand : StrUnbound.Unbounded_String; Command : String(1..100); Command_Last : Natural; begin Socket.Initialize; Address.Addr := Socket.Inet_Addr("127.0.0.1"); Address.Port := 6059; Socket.Create_Socket(Client_Socket); Socket.Set_Socket_Option(Client_Socket, Socket.Socket_Level, (Socket.Reuse_Address, True)); Socket.Connect_Socket(Client_Socket, Address); Channel := Socket.Stream(Client_Socket); IO.Put_Line("Say something..."); loop -- UnboundCommand := UnboundIO.Get_Line; -- Command := StrUnbound.To_String(UnboundCommand); IO.Get_Line (Item => Command, Last => Command_Last); String'Output(Channel, Command (1 .. Command_Last)); if Command (1 .. Command_Last) = "quit" then IO.Put_Line("Good bye..."); Exit; else IO.Put_Line(String'Input(Channel)); end if; end loop; Socket.Free(Channel); Socket.Close_Socket(Client_Socket); Socket.Finalize; end Client;