LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ServerTCPWrite returns -12 sometimes.

I am having a problem with ServerTCPWrite returning a -12, "no connection established". It does this randomly after 4 or 5 times of writing correctly. I suspected that I would get a TCP_DISCONNECT before my write would fail, but this doesn't seem to work. Can someone tell me why I am getting these or if I do get one, how to recover to get back to a "clean" connection. This is a realtime system.
0 Kudos
Message 1 of 2
(2,706 Views)
I am not sure exactly why this would happen. I tried to see in our online documentation if anyone else had a similar type of issue, and was unable to find anything like this. Do you have a TCPcallback function that has an event xType second parameter? You might have a switch structure for that event that has a case for TCP_DISCONNECT, and you can place a breakpoint in here, to see if we ever get into that part of code. If we aren't getting in there, maybe we could put a breakpoint in the case for TCP_DATAREADY, and see how many times the code reaches this case. Let me know how it goes, and thank you for using the Discussion Forums to post your question.

Daniel McChane
Application Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,706 Views)