[En-Nut-Discussion] Ethernut as TCP Client stops trying to connect after a while.
Erik Lindstein
erik at ledutveckling.com
Tue Mar 11 19:20:49 CET 2008
>>
>> Im using a variable(uint16_t) to set the thread sleep time and that
>> one is not type cast to a u_long.
>> Can this (in som strange way) have something to do with this?
>> ( NutSleep(data_exchange_timeout); )
>>
>You can try either casting it to u_long or declare a local u_long, assign
>your
>data_exchange_timeout to it. That way you could also pass it to printf and
>make sure that the value isn't being treated as a negative signed value in
>the
>cast. I only mention that because passing a unsigned 16bit int to NutSleep
>should implicitly convert it to a unsigned 32bit int, but that would explain
>it looking like it died. It wouldn't really explain it if the
>data_exchange_timeout
>weren't being changed during execution, though.
>Nathan
"data_exchange_timeout" changes during execution of the thread.
Depending on if the socket gets connected and data exchanges or not
the timeout value is changed.
But when the socket issnt connected its always assigned the same value
which happens in this case.
So data_exchange_timeout is always set to a #defined value of 3000
then passed to NutSleep().
--
/Erik
More information about the En-Nut-Discussion
mailing list