In this section we will write a very simple client-server
application using PolyORB DSA. The server will provide a Remote
Call Interface
composed of a single Echo_String
function that
will take a String and return it to the caller.
Here is the code for the server:
server.ads:
package Server is pragma Remote_Call_Interface; function Echo_String (S : String) return String; end Server;
server.adb:
package body Server is function Echo_String (S : String) return String is begin return S; end Echo_String; end Server;
And here is the code for the client:
client.adb:
with Ada.Text_IO; use Ada.Text_IO; with Server; procedure Client is begin Put_Line ("The client has started!"); Put ("Thus spake my server upon me:"); Put_Line (Server.Echo_String ("Hi!")); end Client;
For more details about the Distributed Systems Annex, see the Ada Reference Manual [ISO06].