LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSocket open fuction returns error for multiple write operation.

Hi

I have created a dataitem manually and set it to "allow multiple writers", but when i open the datasocket dataitem using the flag "DSConst_ReadWriteBufferedAutoUpdate" it gives me error saying "Cannot create datasocket for buffered operation in 'multithreaded apartment' thread with event modal"

Can any one tell me why am I getting this error and the possible solution for it, any answres will be helpfull

Thanx
Arun
0 Kudos
Message 1 of 2
(2,859 Views)
Hi,

Call:
CA_InitActiveXThreadStyleForCurrentThread(0, COINIT_APARTMENTTHREADED);
as the first function call in the thread that calls DataSocket Open.

This is required because the buffering mode uses apartment threading but the default in CVI apps is multithreaded. Note that the thread must call this function before calling any ActiveX or DataSocket functions to make sure the threading style is not already set. Typically this is called in the main function.

Best regards,
Mohan
0 Kudos
Message 2 of 2
(2,853 Views)