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); 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); if Command = "quit" then String'Output(Channel, "quit"); IO.Put_Line("Good bye..."); Exit; else String'Output(Channel, Command); IO.Put_Line(String'Input(Channel)); end if; end loop; Socket.Free(Channel); Socket.Close_Socket(Client_Socket); Socket.Finalize; end Client;