DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦05e69b6ee⟧ TextFile

    Length: 3265 (0xcc1)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Byte_Defs;
with Transport_Name;
with Utils;

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
        T.Close (Connection => C);
    end Close;

begin

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

    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)))));

    if S /= Transport_Defs.Ok then
        Close;
        raise Connection_Error;
    end if;

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

                T.Connect (C, S);

                if S /= Transport_Defs.Ok then
                    Close;
                    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;
                    raise Connection_Error;
                end if;

                T.Disconnect (Connection => C);
                exit when Service_Identified
                             (Utils.Byte_String_To_String
                                 (Buffer (Buffer'First ..
                                             Buffer'First + Cnt - 1)));
            end;
        end loop;
    end if;

    Ready_To_Receive;

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

                T.Connect (C, S);

                if S /= Transport_Defs.Ok then
                    Close;
                    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;
                    raise Connection_Error;
                end if;

                T.Disconnect (Connection => C);

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

    Close;

end Start_Server;