|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 13312 (0x3400) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Communication, seg_057a6d
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Byte_String_Io; with String_Utilities; with Text_Io; with Utils; with Messages; package body Communication is package Bs renames Bounded_String; package Ti renames Text_Io; package Su renames String_Utilities; Net : constant Transport_Defs.Network_Name := "TCP/IP"; Count : Natural; Msg : Byte_String_Io.Byte_String (0 .. Pmax - 1); procedure Open_Connection (C : in out Object) is begin Transport.Open (Connection => C.Link, Status => C.Status, Network => Net); if Transport.Is_Open (C.Link) then C.Local_Socket := Transport.Local_Socket (C.Link); C.Local_Host := Transport.Local_Host (C.Link); -- *** Ouverture canal O.K. else Text_Io.Put_Line ("***: Ouverture canal echec"); end if; end Open_Connection; procedure Orb_Open_Connection (C : in out Object; Local_Socket : Transport_Defs.Socket_Id) is begin C.Local_Socket := Local_Socket; Transport.Open (Connection => C.Link, Status => C.Status, Network => Net, Local_Socket => C.Local_Socket); if Transport.Is_Open (C.Link) then C.Local_Socket := Transport.Local_Socket (C.Link); -- *** Ouverture canal O.K. else Text_Io.Put_Line ("***: Ouverture canal echec"); end if; end Orb_Open_Connection; procedure Close_Connection (C : Object) is begin Transport.Close (C.Link); -- Ti.Put_Line ("fermeture connection fin"); end Close_Connection; procedure Send (C : in out Object; V_Msg : V_Packet := P_Null; R_Host : T_Host_Id; R_Socket : T_Socket; Try_Nb : Positive := 2; Delaymax : Duration := Duration'Last; L_Host : T_Host_Id := Ficus; L_Socket : T_Socket := Orb_Socket; Success : in out Boolean) is Str_Msg : constant String := Bs.Image (Bs.Variable_String (V_Msg)); Byte_Str_Msg_Cst : constant Byte_Defs.Byte_String := Utils.String_To_Byte_String (Str_Msg); Byte_Str_Msg : Byte_Defs.Byte_String (1 .. Bs.Length (Bs.Variable_String (V_Msg))) := Utils.String_To_Byte_String (Str_Msg); Counter : Positive := Try_Nb; Cpt : Positive := 1; begin Byte_Str_Msg (12 .. 13) := Byte_Defs.Byte_String (L_Socket); Byte_Str_Msg (14 .. 17) := Byte_Defs.Byte_String (L_Host); Transport.Connect (Connection => C.Link, Status => C.Status, Remote_Host => Td.Host_Id (R_Host), Remote_Socket => Td.Socket_Id (R_Socket), Max_Wait => Delaymax); Emission: while not Transport.Is_Connected (C.Link) and Cpt < Try_Nb + 1 loop Transport.Connect (Connection => C.Link, Status => C.Status, Remote_Host => Td.Host_Id (R_Host), Remote_Socket => Td.Socket_Id (R_Socket), Max_Wait => Delaymax); Cpt := Cpt + 1; end loop Emission; if Su.Equal (Td.Image (C.Status), "Ok", True) then Transport.Transmit (C.Link, C.Status, Byte_Str_Msg, Count); Success := True; -- transmission effectuee else Success := False; Text_Io.Put_Line ("Echec de transmission"); end if; -- Text_Io.Put_Line ("*e*: Emission termine"); Transport.Disconnect (C.Link); --or Su.Equal -- (Td.Image (C.Status), "Ok", True); -- Counter := Counter - 1; end Send; procedure Show_Msg (Message : Byte_Defs.Byte_String; Nb : Positive) is V_Msg : constant V_Packet := V_Packet (Bs.Value (Utils.Byte_String_To_String (Message), Pmax)); Str_Msg : constant String := Bs.Extract (Bs.Variable_String (V_Msg), 1, Natural (Nb)); begin Text_Io.Put_Line ("***: Message recu sur " & Natural'Image (Nb) & "=" & Str_Msg); end Show_Msg; procedure Reception (Delaymax : Duration := Duration'Last; Msg : in out Byte_Defs.Byte_String; Count : out Natural; C : in out Object) is Packet : V_Packet; Count2 : Natural; begin --Text_Io.Put_Line ("*R* Reception : attente connection"); Transport.Connect (Connection => C.Link, Status => C.Status, Max_Wait => Delaymax); Reception: while not Transport.Is_Connected (C.Link) loop Transport.Connect (C.Link, C.Status, Delaymax); end loop Reception; if Transport.Is_Connected (C.Link) then -- *R* Reception : connection effectue - essai reception Transport.Receive (Connection => C.Link, Status => C.Status, Data => Msg, Count => Count2, Max_Wait => Delaymax); Count := Count2; -- if Su.Equal (Td.Image (C.Status), "Ok", True) then -- Text_Io.Put_Line ("*e*: count = " & Natural'Image (Count2)); -- Show_Msg (Message => Msg, Nb => Positive (Count2)); -- end if; end if; Transport.Disconnect (C.Link); end Reception; function Get_Local_Host (Connection : Object) return T_Host_Id is begin return T_Host_Id (Connection.Local_Host); end Get_Local_Host; function Get_Local_Socket (Connection : Object) return T_Socket is begin return T_Socket (Connection.Local_Socket); end Get_Local_Socket; end Communication;
nblk1=c nid=3 hdr6=e [0x00] rec0=21 rec1=00 rec2=01 rec3=016 [0x01] rec0=1a rec1=00 rec2=08 rec3=008 [0x02] rec0=12 rec1=00 rec2=07 rec3=056 [0x03] rec0=15 rec1=00 rec2=04 rec3=012 [0x04] rec0=19 rec1=00 rec2=09 rec3=046 [0x05] rec0=15 rec1=00 rec2=02 rec3=006 [0x06] rec0=0e rec1=00 rec2=0b rec3=000 [0x07] rec0=02 rec1=00 rec2=05 rec3=04c [0x08] rec0=18 rec1=00 rec2=03 rec3=016 [0x09] rec0=12 rec1=00 rec2=0b rec3=052 [0x0a] rec0=1a rec1=00 rec2=02 rec3=000 [0x0b] rec0=0e rec1=c0 rec2=00 rec3=000 tail 0x21764ceb687cd960ad5ae 0x42a00088462060003 Free Block Chain: 0x3: 0000 00 05 01 80 80 0f 20 65 6e 64 20 52 65 63 65 70 ┆ end Recep┆ 0x5: 0000 00 0c 00 04 80 01 20 01 65 73 74 20 3a 20 20 22 ┆ est : "┆ 0xc: 0000 00 0a 00 36 00 33 20 20 20 20 20 20 20 20 2d 2d ┆ 6 3 --┆ 0xa: 0000 00 06 00 13 00 0c 20 20 20 20 20 20 20 20 65 6c ┆ el┆ 0x6: 0000 00 00 00 5c 80 30 20 20 2d 2d 54 65 78 74 5f 49 ┆ \ 0 --Text_I┆