Hi - Newbie mistake that I posted this initially in a closed thread. Here it is as a new thread.
Hello - I have been following this (TCP/IP Communication with C++) thread and have a question. I got this to work but I only get the updated data after I stop the robot program and then restart.
I have my socket open connection in a thread. After the connection is made, I then send the ready message to my connected pc, then the pc sends the 4 values in Data. but if I view at the Data in the variables on the pendant, while running the program, they don’t update until I stop the program.
Am I not allowed to run the socket in a thread? Do I need to continually open and then close the socket for each data exchange or can I keep it open until the program ends?
Here is the program If you don’t mind taking a look. I initialize the Data and other variables. Connection is working and I am receiving the other data from the UR as expected.
Perhaps you’ve missed my answer in that thread to your question, so here’s a re-post of my answer:
When a socket closes, any pending data is flushed to the receiving application. The reason why you won’t get is sooner is because you didn’t complete the data packet from the PC side. Missing ) perhaps?