LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSocket autoread

i have callback on a autoread conection to DataSocket.
sometimes the callback is called twice for only
one change!
the program that write to it was cfg as read and i send it with DS_update()

what i can do to slove it ?
0 Kudos
Message 1 of 5
(3,632 Views)
There is more than one type of event for a DataSocket callback (Status updates and data updates). See the documentation of DS_Open. You are probably getting a status update as well as a data update. If you put in a switch statement to only act on the DS_EVENT_DATAUPDATED event, then it should only execute that code once.

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 5
(3,631 Views)
hi chris 10x for your answer but its not help
i have a switch in my callback function and its work most of the time , but after i transfer some data its sometimes transfer the same data again
0 Kudos
Message 3 of 5
(3,631 Views)
That I can't explain. You should only get on DataUpdated event whenever a write occurs. I would make sure that only one write to the item is occurring (not two writes of the same value). If there is only one write, it is probably a problem in the DataSocket implementation, but I couldn't reproduce it here.
0 Kudos
Message 4 of 5
(3,631 Views)
Perhaps you're using DS_Update()? If you're set for AutoRead, DS_Update() isn't needed, and perhaps it is responsible for the redundant send of information.
Message 5 of 5
(3,415 Views)