Hi,
I want to ask about the long timeout of RTCS Connect() function. I want to know is there any way for RTCS Connect() to return directly if it failed to connect ? Because i read that the function will return after timeout, and the minimum timeout for that is 3 mins.
Solved! Go to Solution.
Hi Handy
The RTCS setsockopt() API permits the application to set the OPT_CONNECT_TIMEOUT option on a stream socket, which indicates the timeout (in millisec.) when a call to the connect API using that socket will return indicating a connection time-out error.
The RTCS User's Guide appears to indicate the value specified for the OPT_CONNECT_TIMEOUT option is to be >= 180000 msec.
You can change TCP_SENDTIMEOUT_MIN (tcp_prv.h) to your expected value
#define TCP_SENDTIMEOUT_MIN 100000L /* as per RFC1122 4.2.3.5 */
But it is not recommended, because it violates the RFC1122
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I have another issue regarding to connect() in MQX 4.0 (seemed same in MQX 4.1) - the issue is:
- the connect timeout in 382 seconds - I did not use OPT_CONNECT_TIMEOUT in my code
- the TCP packet is sent, then received an ICMP destination unreachable message which is handled in ICMP_service() and then discarded -
- Why MQX did not sent to some routine in TCP family then send error back to wake up connect() function, instead it keeps sending TCP SYN message in the sequences - 1s, 4s, 10s, 22s, 46s, 94s, 190s, 382s.
- Is there a fix for this misbehavior? I am lost while trying to find a solution.
David
Hi Handy
The RTCS setsockopt() API permits the application to set the OPT_CONNECT_TIMEOUT option on a stream socket, which indicates the timeout (in millisec.) when a call to the connect API using that socket will return indicating a connection time-out error.
The RTCS User's Guide appears to indicate the value specified for the OPT_CONNECT_TIMEOUT option is to be >= 180000 msec.
You can change TCP_SENDTIMEOUT_MIN (tcp_prv.h) to your expected value
#define TCP_SENDTIMEOUT_MIN 100000L /* as per RFC1122 4.2.3.5 */
But it is not recommended, because it violates the RFC1122
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------