Skip to content

T_O_IOData always zero #39

Description

@arkypita

Hello,
I have successfully managed to set up an Ethernet IP connection, read explicit data via GetAttributeSingle, and activate an implicit message session via ForwardOpen.

All the data I set using O_T_IOData correctly goes to the device, but all the data the device send to me are not available inside the array T_O_IOData
The content of the array T_O_IOData is always zero, although through WireShark I can correctly see the data that the device is sending me.
Tested with latest dll both from sourceforge and via nuget package, same behaviour.
What am I doing wrong?

Thanks for any help

Attached screenshot form wireshark/my application and source code.

Image

Image

using Sres.Net.EEIP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EthernetIP
{
    class Program
    {
        static void Main(string[] args)
        {
			EEIPClient EEIP = new EEIPClient();

			EEIP.RegisterSession("192.168.168.44");

			// explicit/aciclic read
			byte[] digitalInputs = EEIP.GetAttributeSingle(102 , 1 , 113);
			Console.WriteLine("Drive temperature: " + (EEIPClient.ToUshort(digitalInputs)) / 10.0 + "°C");


			// implicit/cyclic read

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

			//Parameters from Target -> Originator (da lui a me)
			EEIP.T_O_InstanceID = 121;
			EEIP.T_O_Length = 56;
			EEIP.T_O_RealTimeFormat = Sres.Net.EEIP.RealTimeFormat.Modeless;
			EEIP.T_O_OwnerRedundant = false;
			EEIP.T_O_Priority = Sres.Net.EEIP.Priority.Scheduled;
			EEIP.T_O_VariableLength = false;
			EEIP.T_O_ConnectionType = Sres.Net.EEIP.ConnectionType.Point_to_Point;
			EEIP.RequestedPacketRate_T_O = 500000;    //RPI in  500ms is the Standard value

			EEIP.O_T_IOData[0] = 0x08;

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

			EEIP.O_T_IOData[0] = 0x08;

			while (!Console.KeyAvailable)
			{
				//Read the Inputs Transfered form Target -> Originator
				Console.WriteLine("EEIP.T_O_IOData: " + BitConverter.ToString(EEIP.T_O_IOData).Replace("-", ""));

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

			//Close the Session
			EEIP.ForwardClose();
			//When done, we unregister the session
			EEIP.UnRegisterSession();
		}
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions