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

⟦204ae0f7d⟧ Ada Source

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

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_Serveur 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";
begin

    -- REGISTRATION

    My_Command := Message.Registration;
    Bounded_String.Copy (Source => "Server", 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 ("Server : send registration to ORB..." &
                      Bounded_String.Image (To_Transmit));


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

    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 ("Server : data transmited.");  
    Text_Io.New_Line;

    -- WINTING FOR ID

    Text_Io.Put_Line ("Server : wait for ID...");

    while not Transport.Is_Connected (My_Connection) loop

        Transport.Connect (My_Connection, My_Status);

    end loop;
    Text_Io.Put_Line ("Server : 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 ("Server : status => " &
                          Transport_Defs.Image (My_Status));
    end loop;

    Text_Io.Put_Line ("Server : received message from ORB ");
    Text_Io.New_Line;
    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 PUBLICATION

    My_Command := Message.Publication;
    Bounded_String.Copy (My_Content, "Datum");
    Message.Fill_Command (My_Mess, My_Command);
    Message.Fill_Content (My_Mess, My_Content);
    Message.Fill_Origin (Mess => My_Mess, Orig => My_Id);

    Message.Fill (Data => To_Transmit, Mess => My_Mess);  
    Text_Io.Put_Line ("Server : send publication 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;
    Text_Io.Put_Line ("Server : connected to ORB");
    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 ("Server : data transmited.");  
    Text_Io.New_Line;

    -- WAITING FOR FORWARD

    Text_Io.Put_Line ("Server : wait for Request...");

    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 ("Server : 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);

    -- Reponse au request

    Bounded_String.Copy (My_Content, "02/23/96 4.00pm");
    Message.Fill_Content (My_Mess, My_Content);
    Message.Fill_Command (My_Mess, Message.Forward);
    Message.Fill_Origin (My_Mess, My_Id);
    Message.Fill (Data => To_Transmit, Mess => My_Mess);

    Text_Io.Put_Line ("Server : send publication 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;

    Text_Io.Put_Line ("Server : connected to ORB");

    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 ("Server : data transmited.");  
    Text_Io.New_Line;

    Transport.Close (My_Connection);

end Objet_Serveur;

E3 Meta Data

    nblk1=8
    nid=0
    hdr6=10
        [0x00] rec0=22 rec1=00 rec2=01 rec3=09e
        [0x01] rec0=02 rec1=00 rec2=03 rec3=040
        [0x02] rec0=16 rec1=00 rec2=04 rec3=044
        [0x03] rec0=1f rec1=00 rec2=05 rec3=004
        [0x04] rec0=18 rec1=00 rec2=02 rec3=032
        [0x05] rec0=1c rec1=00 rec2=06 rec3=028
        [0x06] rec0=1a rec1=00 rec2=07 rec3=03e
        [0x07] rec0=0c rec1=00 rec2=08 rec3=000
    tail 0x21761356c87c07cc86cf9 0x42a00088462060003