Connect to TCP Server time-out issue.

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

Connect to TCP Server time-out issue.

跳至解决方案
2,002 次查看
tongjianwu
Contributor III

Hello everyone!

          When creating one TCP client socket in my board to connect other TCP server which is unreachable, the time-out interval is very long, so whether can I modify the interval to some little certain value,less than 20 seconds ?

          The following is the default value:

               Connect Timeout

                    ">  Option name OPT_CONNECT_TIMEOUT
                         Protocol level SOL_TCP
                         Values >=180,000 (RTCS maintains the connection for this number of milliseconds).
                         Default value 480,000 (eight minutes).

Thanks!

From sincerely Jianwu. 

0 项奖励
回复
1 解答
1,704 次查看
soledad
NXP Employee
NXP Employee

Hello Jianwu,

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,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,705 次查看
soledad
NXP Employee
NXP Employee

Hello Jianwu,

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,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,704 次查看
tongjianwu
Contributor III

Hi,Sol

Thanks for your quickly reply.

I modified the macro "TCP_SENDTIMEOUT_MIN",now it works.

When the value is modified,what bad things can happen?

Best Regards.

0 项奖励
回复
1,704 次查看
tongjianwu
Contributor III

Need help,thanks.

0 项奖励
回复