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

⟦c8f11e164⟧ TextFile

    Length: 2929 (0xb71)
    Types: TextFile
    Names: »B«

Derivation

└─⟦bad92a95e⟧ Bits:30000535 8mm tape, Rational 1000, RPC 1_0_2
    └─ ⟦bb34fe6e2⟧ »DATA« 
        └─⟦15d8b76c6⟧ 
            └─⟦this⟧ 

TextFile

with Transport;
with Transport_Defs;
with Text_Io;
with Utils;
with Byte_Defs;
procedure Client is
    Status : Transport_Defs.Status_Code;
    Connection : Transport.Connection_Id;
    Count : Natural;
    Data : Byte_Defs.Byte_String (1 .. 256);
    Send_Data : constant String := "Hello from pip";
    Message_Number : Integer := 0;
    function "=" (L, R : Transport_Defs.Status_Code) return Boolean
        renames Transport_Defs."=";
begin
    loop
        Transport.Open (Connection => Connection,
                        Status => Status,
                        Network => "TCP/IP",
                        Local_Socket => Transport_Defs.Null_Socket_Id);

        Text_Io.Put_Line ("status after open: " &
                          Transport_Defs.Image (Status));
        if Status = Transport_Defs.Ok then

            Transport.Connect
               (Connection => Connection,
                Status => Status,
                Remote_Host => Transport_Defs.Host_Id'(192, 64, 4, 19),
                Remote_Socket => Transport_Defs.Socket_Id'(1, 5),
                Max_Wait => Duration'Last);

            Text_Io.Put_Line ("status after connect: " &
                              Transport_Defs.Image (Status));

            while Status = Transport_Defs.Ok and Message_Number < 10 loop
                Message_Number := Message_Number + 1;
                Transport.Transmit
                   (Connection => Connection,
                    Status => Status,
                    Data => Utils.String_To_Byte_String
                               (Send_Data & Integer'Image (Message_Number)),
                    Count => Count,
                    Max_Wait => Duration'Last);

                Text_Io.Put_Line ("status after send: " &
                                  Transport_Defs.Image (Status) &
                                  "  messages sent " &
                                  Integer'Image (Message_Number));


                if Status = Transport_Defs.Ok then
                    Text_Io.Put_Line ("sent " & Integer'Image (Count));
                    Transport.Receive (Connection => Connection,
                                       Status => Status,
                                       Data => Data,
                                       Count => Count,
                                       Max_Wait => Duration'Last);
                    Text_Io.Put_Line ("server response " &
                                      Utils.Byte_String_To_String
                                         (Data (Data'First ..
                                                   Data'First + Count - 1)));

                else
                    Message_Number := Message_Number - 1;
                end if;
                delay 3.0;
            end loop;
            Message_Number := 0;

            Transport.Close (Connection);


        end if;
        delay 10.0;
    end loop;
end Client;
pragma Main;