TCP connect timeout?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TCP connect timeout?

Frédéric BERNON
Hi group,

I use lwip 1.2.0 at BSD layer. If I try to do a TCP connect to an "unplugged" IP device from my lwip platform, I block my socket too long. Is there some features or opts.h values to use to reduce this timeout?

In tcp.c, I found :

    if (pcb->state == SYN_SENT && pcb->nrtx == TCP_SYNMAXRTX) {
      ++pcb_remove;
      LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached\n"));
    }

So, is the connection timeout equal to TCP_SYNMAXRTX * tcp_slowtmr "period" ?

Is reduce TCP_SYNMAXRTX the good way to reduce the TCP connect timeout?

Thank you for your informations...


====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [hidden email]
Web Site : http://www.hymatom.fr 
====================================


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: TCP connect timeout?

Kieran Mansley
On Tue, 2006-12-12 at 12:23 +0100, Frédéric BERNON wrote:

> Hi group,
>
> I use lwip 1.2.0 at BSD layer.
>
> If I try to do a TCP connect to an "unplugged" IP device from my lwip platform, I block my socket too long. Is there some features or opts.h values to use to reduce this timeout?
>
> In tcp.c, I found :
>
>     if (pcb->state == SYN_SENT && pcb->nrtx == TCP_SYNMAXRTX) {
>       ++pcb_remove;
>       LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached\n"));
>     }
>
> So, is the connection timeout equal to TCP_SYNMAXRTX * tcp_slowtmr "period" ?

Not quite.  TCP_SYNMAXRTX is the number of times it will retransmit the
SYN before giving up.  It doesn't send one every tcp_slowtmr period
though - the gaps between them increase roughly exponentially.  

> Is reduce TCP_SYNMAXRTX the good way to reduce the TCP connect timeout?

It's pretty much the only way, but I would question why you need to.  I
think it would be better to fix your application to be able to cope with
being blocked, rather than make it dependent on a non-standard TCP
timeout.

Kieran



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE : TCP connect timeout?

Frédéric BERNON
In reply to this post by Frédéric BERNON
>> Hi group,
>>
>> I use lwip 1.2.0 at BSD layer.
>>
>> If I try to do a TCP connect to an "unplugged" IP device from my lwip
>> platform, I block my socket too long. Is there some features or opts.h
>> values to use to reduce this timeout?
>>
>> In tcp.c, I found :
>>
>>     if (pcb->state == SYN_SENT && pcb->nrtx == TCP_SYNMAXRTX) {
>>       ++pcb_remove;
>>       LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached\n"));
>>     }
>>
>> So, is the connection timeout equal to TCP_SYNMAXRTX * tcp_slowtmr
>> "period" ?
>
>Not quite.  TCP_SYNMAXRTX is the number of times it will retransmit the SYN before giving up.  It doesn't send one every tcp_slowtmr period
>though - the gaps between them increase roughly exponentially.  

Ok, good information

>
>> Is reduce TCP_SYNMAXRTX the good way to reduce the TCP connect
>> timeout?
>
>It's pretty much the only way, but I would question why you need to.  I think it would be better to fix your application to be able to cope with being blocked, rather than make it dependent on a non-standard TCP timeout.
>

This is always the problem to port some BSD applications to a new socket. Changing them give other applications portability problems. By example, under Winsock and others, it's possible to avoid a long timeout, using some setsockopt options. That's what I want to implement. The best thing for me will be to add a socket option to change the default behavior "per socket". I will study that...

Other question, about TCP receive timeout (if the peer crash without doing a gracefully connection, or if the network between the peer and my lwip platform down, etc...), is TCP_MAXRTX is the main valut to reduce the TCP receive timeout, and is it the "same" algorithm ("...the gaps between them increase roughly exponentially...")?

I already add the SO_RCVTIMEO option at socket/netconn layer for UDP connections, adding a "timeout" parameter to sys_mbox_fetch, if someone want it...

Thank you Kieran for all these informations...



_______________________________________________
lwip-users mailing list
[hidden email] http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: RE : TCP connect timeout?

Kieran Mansley

> Other question, about TCP receive timeout (if the peer crash without
> doing a gracefully connection, or if the network between the peer and
> my lwip platform down, etc...), is TCP_MAXRTX is the main valut to
> reduce the TCP receive timeout, and is it the "same" algorithm
> ("...the gaps between them increase roughly exponentially...")?

Yes.

Kieran



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users