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

⟦edad930c8⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Start_Server, seg_052b09, separate Message_Transport

Derivation

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

E3 Source Code



with Byte_Defs;
with Transport_Name;
with Utils;


with Text_Io;
use Text_Io;
separate (Message_Transport)
procedure Start_Server (Local_Socket : Socket;
                        Buffer_Size : Positive;
                        Wait_For_Identification : Boolean := True) is
    C : T.Connection_Id;
    S : T_Defs.Status_Code;
    N : constant T_Defs.Network_Name := "TCP/IP";
    Lsid : constant Transport_Defs.Socket_Id :=
       (Byte_Defs.Byte (Local_Socket / 256),
        Byte_Defs.Byte (Local_Socket mod 256));
    Cnt : Positive;

    procedure Close is
    begin
        Text_Io.Put_Line ("Start_Server Close");
        T.Close (Connection => C);
    end Close;


    task Registration is
        entry Connection_Ready;
    end Registration;


    task body Registration is
    begin
        Text_Io.Put_Line ("Start_Server accept Connection_Ready");

        accept Connection_Ready;

        Text_Io.Put_Line ("Start_Server Register_Service");

        Register_Service
           (Host => Transport_Name.Local_Host_Name (Network => "TCP/IP"),
            Local_Socket => Socket (Utils.Byte_String_To_Integer
                                       (Bs => Byte_Defs.Byte_String
                                                 (Transport.Local_Socket
                                                     (Connection => C)))));
    end Registration;

begin
    Text_Io.Put_Line ("Start_Server begin & T.Open");

    T.Open (Connection => C, Status => S, Network => N, Local_Socket => Lsid);

    if S /= Transport_Defs.Ok then
        Close;
        Text_Io.Put_Line ("Start_Server connection error");
        raise Connection_Error;
    end if;

    Registration.Connection_Ready;

    Text_Io.Put_Line ("Start_Server connection ready");

    if Wait_For_Identification then
        loop
            declare
                Buffer : Byte_Defs.Byte_String (1 .. Buffer_Size) :=
                   (others => 0);
            begin

                Text_Io.Put_Line
                   ("Start_Server Wait_For_Identification & T.connect");

                T.Connect (C, S);

                if S /= Transport_Defs.Ok then
                    Close;
                    Text_Io.Put_Line ("Start_Server Connection_Error);");
                    raise Connection_Error;
                end if;

                Text_Io.Put_Line ("Start_Server T.receive");

                T.Receive (Connection => C,
                           Status => S,
                           Data => Buffer,
                           Count => Cnt,
                           Max_Wait => Duration'Last);

                if S /= Transport_Defs.Ok then
                    Close;
                    Text_Io.Put_Line
                       ("Start_Server Connection_Error sur receive);");
                    raise Connection_Error;
                end if;

                T.Disconnect (Connection => C);

                Text_Io.Put_Line ("Start_Server T.Disconnect");


                exit when Service_Identified
                             (Utils.Byte_String_To_String
                                 (Buffer (Buffer'First ..
                                             Buffer'First + Cnt - 1)));
            end;
        end loop;
    end if;

    Text_Io.Put_Line ("Start_Server Ready_To_Receive");

    Ready_To_Receive;

    Server_Main:
        loop
            Text_Io.Put_Line ("Start_Server Server_Main debut loop");

            declare
                Buffer : Byte_Defs.Byte_String (1 .. Buffer_Size) :=
                   (others => 0);
            begin

                T.Connect (C, S);

                if S /= Transport_Defs.Ok then
                    Close;
                    Text_Io.Put_Line
                       ("Start_Server Server_Main Connection_Error");
                    raise Connection_Error;
                end if;

                T.Receive (Connection => C,
                           Status => S,
                           Data => Buffer,
                           Count => Cnt,
                           Max_Wait => Duration'Last);

                if S /= Transport_Defs.Ok then
                    Close;
                    Text_Io.Put_Line
                       ("Start_Server Server_Main Connection_Error");
                    raise Connection_Error;
                end if;

                T.Disconnect (Connection => C);

                Text_Io.Put_Line ("Start_Server Server_Main Receive_Callback");

                Receive_Callback (Utils.Byte_String_To_String
                                     (Buffer (Buffer'First ..
                                                 Buffer'First + Cnt - 1)));
            end;
        end loop Server_Main;

    Close;
    Text_Io.Put_Line ("Start_Server close");

end Start_Server;





E3 Meta Data

    nblk1=7
    nid=7
    hdr6=c
        [0x00] rec0=27 rec1=00 rec2=01 rec3=05c
        [0x01] rec0=1d rec1=00 rec2=02 rec3=01a
        [0x02] rec0=1d rec1=00 rec2=05 rec3=02c
        [0x03] rec0=20 rec1=00 rec2=03 rec3=050
        [0x04] rec0=1e rec1=00 rec2=06 rec3=000
        [0x05] rec0=05 rec1=00 rec2=04 rec3=000
        [0x06] rec0=54 rec1=04 rec2=00 rec3=037
    tail 0x2154bb89487a168e867e1 0x42a00088462060003
Free Block Chain:
  0x7: 0000  00 00 00 04 80 01 20 01 20 20 20 20 20 20 20 20  ┆                ┆