Connect to TCP Server time-out issue.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connect to TCP Server time-out issue.

Jump to solution
911 Views
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 Kudos
1 Solution
613 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
614 Views
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 Kudos
613 Views
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 Kudos
613 Views
tongjianwu
Contributor III

Need help,thanks.

0 Kudos