Ejemplo n.º 1
0
 public void Test_ConnectionRequest_S7_1500()
 {
     CollectionAssert.AreEqual(MakeConnectionRequest(1, 0, 3, 0),
                               ConnectionRequest.GetCOTPConnectionRequest(TsapPair.GetDefaultTsapPair(CpuType.S71500, 0, 0)));
     CollectionAssert.AreEqual(MakeConnectionRequest(1, 0, 3, 1),
                               ConnectionRequest.GetCOTPConnectionRequest(TsapPair.GetDefaultTsapPair(CpuType.S71500, 0, 1)));
     CollectionAssert.AreEqual(MakeConnectionRequest(1, 0, 3, 33),
                               ConnectionRequest.GetCOTPConnectionRequest(TsapPair.GetDefaultTsapPair(CpuType.S71500, 1, 1)));
 }
Ejemplo n.º 2
0
        public static byte[] GetCOTPConnectionRequest(TsapPair tsapPair)
        {
            byte[] bSend1 =
            {
                3,                         0, 0, 22,                   //TPKT
                17,                                                    //COTP Header Length
                224,                                                   //Connect Request
                0,                         0,                          //Destination Reference
                0,                        46,                          //Source Reference
                0,                                                     //Flags
                193,                                                   //Parameter Code (src-tasp)
                2,                                                     //Parameter Length
                tsapPair.Local.FirstByte,  tsapPair.Local.SecondByte,  //Source TASP
                194,                                                   //Parameter Code (dst-tasp)
                2,                                                     //Parameter Length
                tsapPair.Remote.FirstByte, tsapPair.Remote.SecondByte, //Destination TASP
                192,                                                   //Parameter Code (tpdu-size)
                1,                                                     //Parameter Length
                10                                                     //TPDU Size (2^10 = 1024)
            };

            return(bSend1);
        }
Ejemplo n.º 3
0
 public void Test_ConnectionRequest_S7_200()
 {
     CollectionAssert.AreEqual(MakeConnectionRequest(16, 0, 16, 1),
                               ConnectionRequest.GetCOTPConnectionRequest(TsapPair.GetDefaultTsapPair(CpuType.S7200, 0, 0)));
 }