RTCS Connect

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RTCS Connect

跳至解决方案
1,850 次查看
handychandra
Contributor III

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.

标签 (1)
标记 (2)
1 解答
1,355 次查看
danielchen
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
1,355 次查看
David_Wu
Contributor III

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

0 项奖励
回复
1,356 次查看
danielchen
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------