Hi,
I am writing a GUI application in LabWindows that connects to a TCP/IP Server on a RT Target (PXIe). I have no issues if I connect on startup in the main function. However, I have a TCP check function that is called via async timer that checks the status of the connection every 10s, and reconnects if needed. When reconnected via this callback, I seem to have issues with the TCP Callback not being called when data is sent from the server to this client. It seems to register successfully and I cant send data to the server, but the callback never gets invoked when receiving data. I'm not too experienced with callbacks/threading, so go easy on me if it's something obvious.
Here is sample code fragments to get an idea of what I'm doing essentially:
int main (int argc, char *argv[])
{
...
ConnectToTCPServerEx (&gDataConnection, TARGET_PORT, TARGET_ADDRESS, TCPDataCallback, 0, 5000, TCP_ANY_LOCAL_PORT);
NewAsyncTimer(10,-1,1,TCPIPCheckCallBack,0);
...
}
int CVICALLBACK TCPIPCheckCallBack(int reserved, int timerId, int event, void *callbackData, int eventData1, int eventData2)
{
...
if (!gTCPConnected)
(ConnectToTCPServerEx (&gDataConnection, TARGET_PORT, TARGET_ADDRESS, TCPDataCallback, 0, 5000, TCP_ANY_LOCAL_PORT);
...
}