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

⟦14c0e2eb1⟧ Ada Source

    Length: 4096 (0x1000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Start_Server, seg_0292f6, separate Message

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



separate (Message)
procedure Start_Server (Local_Socket : Socket; Buffer_Size : Positive) 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
        T.Close (Connection => C);
    end Close;

begin

    if not Transport.Is_Open (Connection => C) then

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

        if S /= Transport_Defs.Ok then
            Text_Io.Put_Line ("get: *** open failed s => " &
                              Transport_Defs.Image (S));
            Close;
        else
            Text_Io.Put_Line ("get: +++ Server Socket Open");
        end if;

    else
        Text_Io.Put_Line
           ("get: --* Server Socket Already Open, reusing socket");
    end if;

    -- if not Transport.Is_Connected (Connection => C) then
    --
    --     T.Connect (C, S);
    --
    --     if S /= Transport_Defs.Ok then
    --         Text_Io.Put_Line ("get: *** connect failed s => " &
    --                           Transport_Defs.Image (S));
    --         Close;
    --     else
    --         Text_Io.Put_Line ("+++ Server Connected");
    --     end if;
    --
    --
    -- else
    --     Text_Io.Put_Line ("--* Server Socket Already Connected");
    -- end if;
    --
    loop
        declare
            Buffer : Byte_Defs.Byte_String (1 .. Buffer_Size) := (others => 0);
        begin
            T.Connect (C, S);
            T.Receive (Connection => C,
                       Status => S,
                       Data => Buffer,
                       Count => Cnt,
                       Max_Wait => Duration'Last);

            if S /= Transport_Defs.Ok then
                Text_Io.Put_Line ("get: receive failed s => " &
                                  Transport_Defs.Image (S));
                Close;
            end if;  
            T.Disconnect (Connection => C);
            Receive_Callback (Utils.Byte_String_To_String
                                 (Buffer (Buffer'First ..
                                             Buffer'First + Cnt - 1)));
        end;
    end loop;



    T.Close (Connection => C);

end Start_Server;

E3 Meta Data

    nblk1=3
    nid=0
    hdr6=6
        [0x00] rec0=23 rec1=00 rec2=01 rec3=01a
        [0x01] rec0=1f rec1=00 rec2=03 rec3=03c
        [0x02] rec0=12 rec1=00 rec2=02 rec3=000
    tail 0x21722a60083cc7eee1e69 0x42a00088462060003