rossmann-engineering / EEIP.NET

Ethernet/IP compatible library for .NET implementations
MIT License
214 stars 123 forks source link

Connection failure Code: 265 Invalid connection size #19

Open 1mohamedelasri opened 4 years ago

1mohamedelasri commented 4 years ago

I'm using EEIP.NET to connect a moxa ilogik e1200 card through CIP protocol . I'm already using the explicit messaging, everything works like a charm. However, i encountered some issues while using the implicit messaging, and specifically when trying to use transportClass_trigger of CIP that is implemented in your library.

On the EIPClient.cs : line 452 we have commonPacketFormat.Data.Add(0x01); which means i think class: 0 , direction: client , trigger: cyclic. using these default parameters, every thing works fine with explicit messaging.

However, whenever I try to change that parameter, I encounter the invalid connection size error. These are the transportclass combinations I tested and which produce the connection size error . Capture d’écran 2020-06-09 à 13 05 43

This is my main code : ` static void Main(string[] args) { EEIPClient eeipClient = new EEIPClient();

        eeipClient.IPAddress = "192.168.127.253";
        //A Session has to be registered before any communication can be established
        eeipClient.RegisterSession();
        eeipClient.ConfigurationAssemblyInstanceID = 0x64;

        Console.WriteLine("STATATTATTAT");

        //Parameters from Originator -> Target
        eeipClient.O_T_InstanceID = 0x66;              //Instance ID of the Output Assembly
        eeipClient.O_T_RealTimeFormat = Sres.Net.EEIP.RealTimeFormat.Header32Bit;   //Header Format
        eeipClient.O_T_OwnerRedundant = false;
        eeipClient.O_T_Priority = Sres.Net.EEIP.Priority.Scheduled;
        eeipClient.O_T_VariableLength = false;
        eeipClient.O_T_ConnectionType = Sres.Net.EEIP.ConnectionType.Point_to_Point;
        eeipClient.RequestedPacketRate_O_T = 50000;        //500ms is the Standard value
        eeipClient.O_T_Length = eeipClient.Detect_O_T_Length(); ;                     //The Method "Detect_O_T_Length" detect the Length using an UCMM Message

        //Parameters from Target -> Originator
        eeipClient.T_O_InstanceID = 0x65;
        eeipClient.T_O_RealTimeFormat = Sres.Net.EEIP.RealTimeFormat.Modeless;
        eeipClient.T_O_OwnerRedundant = false;
        eeipClient.T_O_Priority = Sres.Net.EEIP.Priority.Urgent;
        eeipClient.T_O_VariableLength = false;
        eeipClient.T_O_ConnectionType = Sres.Net.EEIP.ConnectionType.Point_to_Point;
        eeipClient.RequestedPacketRate_T_O = 50000;    //RPI in  500ms is the Standard value
        eeipClient.T_O_Length = eeipClient.Detect_T_O_Length();                    //The Method "Detect_O_T_Length" detect the Length using an UCMM Message

        //Forward open initiates the Implicit Messaging
        eeipClient.ForwardOpen(false);

        while (true)
        {

            //Read the Inputs Transfered form Target -> Originator
            Console.WriteLine("State of first Input byte [0] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 0));
            Console.WriteLine("State of first Input byte:[1] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 1));
            Console.WriteLine("State of first Input byte:[2] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 2));
            Console.WriteLine("State of first Input byte:[3] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 3));
            Console.WriteLine("State of first Input byte:[4] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 4));
            Console.WriteLine("State of first Input byte:[5] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 5));
            Console.WriteLine("State of first Input byte:[6] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 6));
            Console.WriteLine("State of first Input byte:[7] " + EEIPClient.ToBool(eeipClient.T_O_IOData[0], 7));

            System.Threading.Thread.Sleep(1000);
        }

        ////Close the Session
        eeipClient.ForwardClose();
        eeipClient.UnRegisterSession();

    }
}`

I would like to thank you for this beautiful library and for your support to open source community.