I use MQX with RTCS V4.2 in My system which provides a Modbus TCP server and supports four connections at same time.
There is a problem of my system when there is a connection is closed and another connection is setup in a short time, for example, no more than 2 milliseconds. The problem is the connection which should be closed will send out data using the new setup socket.
I try to investigate this issue and use following code to check the socket I will use:
CurPort = ((struct tcb_struct *)(((struct socket_struct *)Modbus_sock)->TCB_PTR))->SOCKET;
Modbus_sock is the socket I got form the accept function, I use this socket to read the socket stored in the TCB. If there is no problem, the socket read from the TCB is always correct, but when there is an error, the value I got is 0 or 3725.
Did someone got this problem before? Or can give me some tip about this issue.
Thank you very much!