Hi bro,
I'm writing a console application using Subscription to trigger another Subscription but notice that after Unsubscribe the ID still count up. Is this normal or that subscription haven't unsubscribed and released?
Thank for your help!!
private static EthernetIPforCLX EthernetIPforCLXCom1;
private static int SubscriptionID0;
private static int SubscriptionID1;
static void Main(string[] args)
{
EthernetIPforCLXCom1 = new EthernetIPforCLX();
EthernetIPforCLXCom1.IPAddress = "192.168.137.134";
EthernetIPforCLXCom1.ProcessorSlot = 0;
EthernetIPforCLXCom1.PollRateOverride = 0;
SubscriptionID0 = EthernetIPforCLXCom1.Subscribe("_Event_buffer_PLC_ptr", 1, EthernetIPforCLXCom1_SubscriptionDataReceived);
EthernetIPforCLXCom1.SubscriptionDataReceived += EthernetIPforCLXCom1_SubscriptionDataReceived;
EthernetIPforCLXCom1.SubscriptionDataReceived += EthernetIPforCLXCom1_SubscriptionDataReceived1;
while (true)
{
Thread.Sleep(10);
}
}
private static void EthernetIPforCLXCom1_SubscriptionDataReceived(object sender, PlcComEventArgs e)
{
//throw new NotImplementedException();
SubscriptionID1 = EthernetIPforCLXCom1.Subscribe("_Event_data_buffer_array[0,0]", 1, EthernetIPforCLXCom1_SubscriptionDataReceived1);
}
private static void EthernetIPforCLXCom1_SubscriptionDataReceived1(object sender, PlcComEventArgs e)
{
//throw new NotImplementedException();
//do st
EthernetIPforCLXCom1.UnSubscribe(SubscriptionID1);
Console.WriteLine(SubscriptionID1);
}