LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get new thread to receive TCP callback events in CVI 5.01?

I'm running CVI 5.01 on Windows 2000.
I want to run a server in its own isolated thread from the main app(and the gui).
I'm registering a server in a new thread, and external clients are able to connect to the server.

However, I am not receiving any TCP Server callbacks in the new thread.

The RegisterTCPserver function call identifies a callback function, but its not getting called(or not receiving events).

Any Ideas? Is there anything special I need to do in the new thread? Is there anything special I need to do in the server callback function?

Also, is it possible to use the SDK SleepEx function to wake on TCP callbacks?

The basic shell of the TCP thread is as follows:


TCPThread
{
RegisterTCPServer(Port, ServerCallback, (void *) SERVERTAG);

while(!done)
{
Sleep(0);
}

}


Thanks.
0 Kudos
Message 1 of 2
(3,026 Views)
You need to put in a ProcessSystemEvents() call in your while loop in order to check for events that are coming in. Usually, in your main thread you have a UI and have called RunUserInterface() which automatically checks for events in a loop. In this case, you thread isn't using RunUserInterface() so you need to check for events yourself with ProcessSystemEvents().

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 2
(3,026 Views)