From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

UDP Callback works when executed from TestStand sequence editor but does not work when executed from Test Exec?

I have an application written in CVI compiled to a .dll and executed from TestStand. When it is executed from the TestStand Sequence editor it works fine. When I load the same sequence into Test Exec and run it, the UDP callback never executes. I can monitor the Ethernet traffic using Wireshark and the correct messages are being transmitted to the P.C. I have run out of ideas as to why the call back never executes even though I can clearly see that the correct packets are coming back. Does anyone have an idea of what might be happening? I wonder if there may be an execution speed issue?

 

Windows 7 Ultimate 64 Bit, Quad Core i7 Intel CPU, 16 GB RAM. CVI 2013 & TestStand 2013.

  

Thank You in advance for your help.

 

 

void __declspec(dllexport) __stdcall startUDPR5Connection(short *errorOccurred, 

                                                          long *errorCode, char errorMsg[1024])

{

 

  error = UDPR5_startEthernet();

 

}

 

 

int UDPR5_startEthernet (void)

{

 

   error = CreateUDPChannelConfig(19025, "192.168.80.50",1,R5Callback,NULL,&readerR5Channel);

 

   error = UDPMulticastSubscribe(readerR5Channel, "230.77.69.76", NULL);

 

   error = CreateUDPChannelConfig(19024, "192.168.80.50",0,NULL,NULL,&writerR5Channel);

 

   error = CreateUDPChannelConfig(14502, "192.168.80.50",0,NULL,NULL,&writerR5U3Channel);

 

}

 

 

int CVICALLBACK R5Callback (unsigned channel, int eventType, int errCode, void *callbackData)

{

 

   do  //loop until entire packet has arrived

   {

      LastSize = size;

      Delay(.001);

      // Read the size of the arrived data packet.

      size = UDPRead(channel, NULL, 0, UDP_DO_NOT_WAIT, NULL, NULL);  

   }

   while (LastSize < size);

 

   msg = malloc(size + 1); // Memory size is allocated on readback size

 

   // Read the waiting message into the allocated buffer.

   size = UDPRead(channel, msg, size, UDP_DO_NOT_WAIT, &srcPort, "230.77.68.76");

 

   if (msg) free(msg); // Memory size is de-allocated              

 

}                                                             

0 Kudos
Message 1 of 2
(4,231 Views)

Hi GarWiKas,

 

To clarify, is the Callback not executing at all (my understanding), or is the UDPRead function returning 0 as though no data is available?

 

Which Test Exec are you using? I would suggest using a full-featured Test Exec and running it as an Administrator if you are not already doing so. I'm not sure about it being an issue of execution speed, as the execution speed of the DLL call should be the same for each environment. 

 

Are you aware of any differences other than the execution environment? (i.e. Is the UDP broadcast the same?)

 

Are you doing direct DLL calls using the C/C++ DLL Adapter in TestStand, or is the DLL being called indirectly through another code module? Would it be possible to try using our UDP Read example to see if it encounters the same problem?

 

I have been trying to reproduce the issue with no success so far. It would be helpful if you could attach a copy of your sequence file and DLL.

Steven Gloor
Staff Customer Engineer - CTA, CLD
0 Kudos
Message 2 of 2
(4,177 Views)