Currently, communication between two different robots in VC can be realized. And achieved synchronization. The implementation code is as follows:
The SOCK _Type in the code is SOCK_DGRAM. The way to establish a connection is that the server listens but does not reply. The client only sends the data, so this is the UDP transmission form. However, our robot does not support UDP only supports TCP/IP, so UDP cannot be applied to the communication between physical robots and virtual robots we now have.
We tried TCP/IP non-blocking and blocking transmission modes in VC. Since VC is based on single-threaded transport, we use non-blocking transport. However, after the program is written, the situation is not good during the operation of the VC. Code show as below:
As long as it runs, it will be stuck. How can I solve it?