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

⟦8abcc342f⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Objet_Abonne, seg_055de8

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_Abonne 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 ("Abonne : 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 ("Abonne : wait for ID...");

    while not Transport.Is_Connected (My_Connection) loop

        Transport.Connect (My_Connection, My_Status);

    end loop;

    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 ("Abonne : 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 ABONNEMENT

    Text_Io.Get (Order);

    My_Command := Message.Subscription;
    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 ("Abonne : 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);

    -- Wait for all datum

    Text_Io.Put_Line ("Abonne : Wait for all datum..");

    loop
        while not Transport.Is_Connected (My_Connection) loop

            Transport.Connect (My_Connection, My_Status);

        end loop;

        loop

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

        end loop;

        Text_Io.Put_Line ("Abonne : 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);
        Text_Io.Get (Order);
        exit when Order = 'q';
    end loop;
    Transport.Close (My_Connection);

end Objet_Abonne;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=2a rec1=00 rec2=01 rec3=036
        [0x01] rec0=19 rec1=00 rec2=04 rec3=026
        [0x02] rec0=22 rec1=00 rec2=03 rec3=026
        [0x03] rec0=1a rec1=00 rec2=02 rec3=060
        [0x04] rec0=22 rec1=00 rec2=05 rec3=004
        [0x05] rec0=0a rec1=00 rec2=06 rec3=001
    tail 0x2176134f087c07d27cccb 0x42a00088462060003