DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦6e9c0efa7⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Objet_Client, seg_055dbd

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Message;
with Bounded_String;  
with Text_Io;  
with Transport_Defs;
with Transport;
with Identification;
with Utils;
with Byte_Defs;

procedure Objet_Client is

    My_Mess : Message.Tmessage;
    My_Content : Message.Content_String;
    My_Command : Message.Command_Type;
    My_Id : Identification.Tclient_Id := 0;

    My_Host : Message.Content_String;
    My_Socket : Message.Content_String;
    My_Name : Message.Content_String;

    Cpt : Natural;

    My_Connection : Transport.Connection_Id;
    My_Status : Transport_Defs.Status_Code;

    To_Transmit : Message.Data_String;  
    To_Accept : Message.Data_String;

    From_Orb : Byte_Defs.Byte_String (0 .. 255);

    The_Net : constant Transport_Defs.Network_Name := "TCP/IP";

    Order : Character;

begin

    -- SEND REGISTRATION

    My_Command := Message.Registration;
    Bounded_String.Copy (Source => "Client", Target => My_Name);
    Identification.Host_Id_To_String (Transport.Local_Host (The_Net), My_Host);

    Transport.Open (My_Connection, My_Status, The_Net);

    Identification.Socket_Id_To_String
       (Transport.Local_Socket (My_Connection), My_Socket);

    My_Content := My_Socket;

    Bounded_String.Append (My_Content, ':');
    Bounded_String.Append (My_Content, My_Host);
    Bounded_String.Append (My_Content, ':');
    Bounded_String.Append (My_Content, My_Name);
    Bounded_String.Append (My_Content, ':');

    Message.Fill_Content (Mess => My_Mess, Cont => My_Content);
    Message.Fill_Command (Mess => My_Mess, Comm => My_Command);
    Message.Fill_Origin (Mess => My_Mess, Orig => My_Id);
    Message.Fill (Data => To_Transmit, Mess => My_Mess);

    Text_Io.Put_Line ("Client : send message to ORB..." &
                      Bounded_String.Image (To_Transmit));

    while not Transport.Is_Connected (My_Connection) loop

        Transport.Connect (My_Connection, My_Status,
                           (193, 54, 146, 132), (10, 42));
    end loop;

    Transport.Transmit (My_Connection, My_Status,
                        Utils.String_To_Byte_String
                           (Bounded_String.Image (To_Transmit)), Cpt);

    Transport.Disconnect (My_Connection);

    Text_Io.Put_Line ("Client : data transmited.");

    -- WAITING FOR ID

    Text_Io.New_Line;
    Text_Io.Put_Line ("Client : wait for ID...");

    while not Transport.Is_Connected (My_Connection) loop

        Transport.Connect (My_Connection, My_Status);

    end loop;

    Text_Io.Put_Line ("Client : status => " & Transport_Defs.Image (My_Status));

    loop

        Transport.Receive (My_Connection, My_Status, From_Orb, Cpt);
        exit when Transport_Defs.Image (My_Status) = "OK";
        Text_Io.Put_Line ("Client : status => " &
                          Transport_Defs.Image (My_Status));
    end loop;


    Text_Io.Put_Line ("Client : received message from ORB ");
    Bounded_String.Copy
       (Target => To_Accept,
        Source => Utils.Byte_String_To_String (From_Orb) (1 .. Cpt));
    Message.Unfill (To_Accept, My_Mess);
    Message.Unfill_Content (My_Mess, My_Content);
    My_Id := Identification.Tclient_Id'Value
                (Bounded_String.Image (My_Content));

    Text_Io.Put_Line (Utils.Byte_String_To_String (From_Orb) (1 .. Cpt));
    Transport.Disconnect (My_Connection);

    -- SEND A REQUEST Datum

    Text_Io.Get (Order);
    My_Command := Message.Request;
    Bounded_String.Copy (My_Content, "Datum");

    Message.Fill_Content (Mess => My_Mess, Cont => My_Content);
    Message.Fill_Command (Mess => My_Mess, Comm => My_Command);
    Message.Fill_Origin (Mess => My_Mess, Orig => My_Id);
    Message.Fill (Data => To_Transmit, Mess => My_Mess);

    Text_Io.Put_Line ("Client : send message to ORB..." &
                      Bounded_String.Image (To_Transmit));

    delay 20.0;

    while not Transport.Is_Connected (My_Connection) loop
        Transport.Connect (My_Connection, My_Status,
                           (193, 54, 146, 132), (10, 42));
    end loop;

    delay 10.0;

    Transport.Transmit (My_Connection, My_Status,
                        Utils.String_To_Byte_String
                           (Bounded_String.Image (To_Transmit)), Cpt);

    Transport.Disconnect (My_Connection);

    Text_Io.Put_Line ("Client : data transmited.");

    -- Waiting for the answer

    Text_Io.New_Line;
    Text_Io.Put_Line ("Client : wait for answer...");

    while not Transport.Is_Connected (My_Connection) loop

        Transport.Connect (My_Connection, My_Status);

    end loop;

    Text_Io.Put_Line ("Client : status => " & Transport_Defs.Image (My_Status));

    loop

        Transport.Receive (My_Connection, My_Status, From_Orb, Cpt);
        exit when Transport_Defs.Image (My_Status) = "OK";

    end loop;


    Text_Io.Put_Line ("Client : received message from ORB ");

    Bounded_String.Copy
       (Target => To_Accept,
        Source => Utils.Byte_String_To_String (From_Orb) (1 .. Cpt));

    Message.Unfill (To_Accept, My_Mess);
    Message.Unfill_Content (My_Mess, My_Content);

    Text_Io.Put_Line (Utils.Byte_String_To_String (From_Orb) (1 .. Cpt));

    Transport.Disconnect (My_Connection);

    Transport.Close (My_Connection);

end Objet_Client;

E3 Meta Data

    nblk1=8
    nid=7
    hdr6=e
        [0x00] rec0=2a rec1=00 rec2=01 rec3=036
        [0x01] rec0=1a rec1=00 rec2=04 rec3=020
        [0x02] rec0=00 rec1=00 rec2=05 rec3=00c
        [0x03] rec0=21 rec1=00 rec2=03 rec3=072
        [0x04] rec0=1c rec1=00 rec2=08 rec3=014
        [0x05] rec0=24 rec1=00 rec2=02 rec3=012
        [0x06] rec0=10 rec1=00 rec2=06 rec3=001
        [0x07] rec0=c8 rec1=7a rec2=94 rec3=494
    tail 0x217612ddc87c077f5a973 0x42a00088462060003
Free Block Chain:
  0x7: 0000  00 00 03 fc 80 35 5f 54 6f 5f 53 74 72 69 6e 67  ┆     5_To_String┆