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

⟦35e966d38⟧ TextFile

    Length: 9542 (0x2546)
    Types: TextFile
    Names: »B«

Derivation

└─⟦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 Net_Info;
WITH Text_Io;
WITH Transport;
WITH Transport_Defs;
WITH Utils;
PACKAGE BODY Test_Transport_Level IS


   FUNCTION "=" (L, R : Transport_Defs.Status_Code) RETURN Boolean
       RENAMES Transport_Defs."=";



   Connection_Retry_Interval : CONSTANT Duration := 60.0;
   TYPE Retries IS RANGE 1 .. 3;




   PROCEDURE Start_Client IS

      Status            : Transport_Defs.Status_Code     := Transport_Defs.Ok;
      Connection        : Transport.Connection_Id;
      Message           : CONSTANT Byte_Defs.Byte_String :=
         Utils.String_To_Byte_String (Net_Info.Test_String);
      Bytes_Transmitted : Natural;
      Bytes_Received    : Natural;
      Rec_Buf           : Byte_Defs.Byte_String (1 .. 1024);

   BEGIN

      FOR I IN 1 .. 3 LOOP

         IF NOT Transport.Is_Open (Connection => Connection) THEN

            Transport.Open (Connection   => Connection,
                            Status       => Status,
                            Network      => Net_Info.Net_Name,
                            Local_Socket => Transport_Defs.Null_Socket_Id);

            IF Status /= Transport_Defs.Ok THEN
               Text_Io.Put_Line
                  ("*** Client Socket Open Failed. Error Code: " &
                   Transport_Defs.Image (Status));
               RETURN;

            ELSE
               Text_Io.Put_Line ("+++ Client Socket Open");
            END IF;

         ELSE

            Text_Io.Put_Line
               ("--* Client Socket Already Open, reusing socket");

         END IF;

         IF NOT Transport.Is_Connected (Connection => Connection) THEN

            Transport.Connect (Connection    => Connection,
                               Status        => Status,
--                               Remote_Host   => Net_Info.Sparc_Address,
                               Remote_Host   => Net_Info.R1000_Address,
--                               Remote_Socket => Net_Info.Sparc_Socket,
                               Remote_Socket => Net_Info.R1000_Socket,
                               Max_Wait      => Duration'Last);

            IF Status /= Transport_Defs.Ok THEN
               Text_Io.Put_Line ("*** Client Connect Failed. Error Code: " &
                                 Transport_Defs.Image (Status));
               RETURN;

            ELSE
               Text_Io.Put_Line ("+++ Client Connected");
            END IF;

         ELSE

            Text_Io.Put_Line ("--* Client Socket Already Connected");

         END IF;


         Data_Transfer_Loop:
            FOR I IN 1 .. 10 LOOP

               Bytes_Transmitted := 0;

               Transport.Transmit (Connection => Connection,
                                   Status     => Status,
                                   Data       => Message,
                                   Count      => Bytes_Transmitted,
                                   Max_Wait   => Duration'Last,
                                   More       => False);

               IF Status /= Transport_Defs.Ok THEN

                  Text_Io.Put_Line
                     ("*** Client Transmission Failed. Error Code: " &
                      Transport_Defs.Image (Status));

                  EXIT Data_Transfer_Loop;

               ELSIF Bytes_Transmitted /= Message'Length THEN

                  Text_Io.Put_Line ("--* Client Transmission Incomplete.");

               ELSE

                  Text_Io.Put_Line ("+++ Client Tranmission Completed.");

               END IF;


               Transport.Receive (Connection => Connection,
                                  Status     => Status,
                                  Data       => Rec_Buf,
                                  Count      => Bytes_Received,
                                  Max_Wait   => Duration'Last);

               IF Status /= Transport_Defs.Ok THEN

                  Text_Io.Put_Line ("*** Client Receive Failed. Error Code: " &
                                    Transport_Defs.Image (Status));

                  EXIT Data_Transfer_Loop;

               ELSE

                  Text_Io.Put_Line ("+++ Client Received: " &
                                    Utils.Byte_String_To_String
                                       (Rec_Buf (1 .. Bytes_Received)));

               END IF;


            END LOOP Data_Transfer_Loop;

         IF Transport.Is_Connected (Connection => Connection) THEN
            Transport.Disconnect (Connection => Connection);
         END IF;

         IF Transport.Is_Open (Connection => Connection) THEN
            Transport.Close (Connection => Connection);
         END IF;

         DELAY 5.0;
      END LOOP;
   END Start_Client;




   PROCEDURE Start_Server IS

      Status            : Transport_Defs.Status_Code := Transport_Defs.Ok;
      Connection        : Transport.Connection_Id;
      Bytes_Transmitted : Natural;
      Bytes_Received    : Natural;
      Rec_Buf           : Byte_Defs.Byte_String (1 .. 1024);


   BEGIN
      Accept_Loop:
         LOOP

            Open_Loop:
               FOR Try IN Retries LOOP
                  IF NOT Transport.Is_Open (Connection => Connection) THEN

                     Transport.Open (Connection   => Connection,
                                     Status       => Status,
                                     Network      => Net_Info.Net_Name,
                                     Local_Socket => Net_Info.Sparc_Socket);

                     IF Status /= Transport_Defs.Ok THEN
                        Text_Io.Put_Line
                           ("*** Server Socket Open Failed. Error Code: " &
                            Transport_Defs.Image (Status));

                        IF Status = Transport_Defs.Socket_In_Use THEN
                           Text_Io.Put_Line ("--- will retry.");
                           DELAY Connection_Retry_Interval;
                        ELSE
                           RETURN;
                        END IF;

                     ELSE
                        Text_Io.Put_Line ("+++ Server Socket Open");
                        EXIT Open_Loop;
                     END IF;

                  ELSE

                     Text_Io.Put_Line
                        ("--* Server Socket Already Open, reusing socket");
                     EXIT Open_Loop;

                  END IF;

               END LOOP Open_Loop;

            IF NOT Transport.Is_Connected (Connection => Connection) THEN

               Transport.Connect (Connection => Connection,
                                  Status     => Status,
                                  Max_Wait   => Duration'Last);

               IF Status /= Transport_Defs.Ok THEN
                  Text_Io.Put_Line ("*** Server Connect Failed. Error Code: " &
                                    Transport_Defs.Image (Status));
                  RETURN;

               ELSE
                  Text_Io.Put_Line ("+++ Server Connected");
               END IF;

            ELSE

               Text_Io.Put_Line ("--* Server Socket Already Connected");

            END IF;


            Data_Reception_Loop:
               LOOP

                  Bytes_Received := 0;

                  Transport.Receive (Connection => Connection,
                                     Status     => Status,
                                     Data       => Rec_Buf,
                                     Count      => Bytes_Received,
                                     Max_Wait   => Duration'Last);

                  IF Status /= Transport_Defs.Ok THEN

                     Text_Io.Put_Line
                        ("*** Server Receive Failed. Error Code: " &
                         Transport_Defs.Image (Status));

                     EXIT Data_Reception_Loop;

                  ELSE

                     Text_Io.Put_Line ("+++ Server Received: " &
                                       Utils.Byte_String_To_String
                                          (Rec_Buf (1 .. Bytes_Received)));

                  END IF;


                  IF Bytes_Received > 0 THEN

                     Bytes_Transmitted := 0;

                     Transport.Transmit (Connection => Connection,
                                         Status => Status,
                                         Data => Rec_Buf (1 .. Bytes_Received),
                                         Count => Bytes_Transmitted,
                                         Max_Wait => Duration'Last,
                                         More => False);

                     IF Status /= Transport_Defs.Ok THEN

                        Text_Io.Put_Line
                           ("*** Server Transmission Failed. Error Code: " &
                            Transport_Defs.Image (Status));

                        EXIT Data_Reception_Loop;

                     ELSIF Bytes_Transmitted /= Bytes_Received THEN

                        Text_Io.Put_Line
                           ("--* Server Transmission Incomplete.");

                     ELSE

                        Text_Io.Put_Line ("+++ Server Tranmission Completed.");

                     END IF;

                  END IF;

               END LOOP Data_Reception_Loop;

            IF Transport.Is_Connected (Connection => Connection) THEN
               Transport.Disconnect (Connection => Connection);
            END IF;

            IF Transport.Is_Open (Connection => Connection) THEN
               Transport.Close (Connection => Connection);
            END IF;

         END LOOP Accept_Loop;

   END Start_Server;


END Test_Transport_Level;