Im running LwIP in NOSYS mode on a microcontroller.
Currently I have trouble implementing a RAW TCP Client.
I was able to run the HTTP Server including CGI/SSI and IPerf both as client
My Client gets a connection to a server(simple pyhton example server) and I
am able to send a few bytes(Hello World messages).
The problem is that after a few minutes the client stop working and even the
poll_cb stop getting called from LwIP.
It also doesn't matter if I send data while connected or do nothing after a
few minutes its just stop working.
I watched the connection via wireshark and there is nothing that would
indicate any kind of connection close or timeout.
The thing is that the HTTP Server still functions as usual so
sys_check_timeouts still gets called.
Also all callbacks where registered( arg, recv, sent, poll, err ) so LwIP
doesn't report anything back its just stop working.
I tried to look at the PCB but found nothing useful same with various debug
I put some data and source code below maybe someone can have a look or give
me a direction where to look.
Thanks for your help.
Am 16.03.2020 um 17:42 schrieb Jonas97:
> Hi Hugh,
> I did not find any specific documentation on the way sys_now() should be
For things like this, improved documentation is always welcome. Plus it
should be easy to provide it for everyone...
> After debugging I noticed that sys_check_timeouts was using following macro:
> /* Check if timer's expiry time is greater than time and care about u32_t
> wraparounds */
> #define TIME_LESS_THAN(t, compare_to) ( (((u32_t)((t)-(compare_to))) >
> LWIP_MAX_TIMEOUT) ? 1 : 0 )
> So I suspect that the timer should run all the way to the unsigned 32 bit
> wraparound point. This is only hit after 49 days so I didn't dig deeper as
> my application doesn't run that long.
Yes, it should just continue. And yes, it's hard to test since this is a
purely port-provided function.
> The problem was that the ms function for my microcontroller was wrapping
> around after 71583 so instead of hitting 71584 it would start at zero again.
> Below is my quick and dirty fix for this which might contain future bugs, is
> gcc specific and also specific to the 71583 wrap around point. Feedback
> always appreciated.
> u32_t sys_now( void )
> static uint32_t ms = 0;
> static uint32_t lastMs = 0;
> uint32_t newMs = cpu_cy_2_ms( Get_sys_count(), sysclk_get_cpu_hz() );
> uint32_t diffMs;
> if( newMs < lastMs )
> diffMs = ( newMs + 4294895712 ) - ( lastMs + 4294895712 );
> diffMs -= 4294895712;
> diffMs = newMs - lastMs;
> lastMs = newMs;
> ms += diffMs;
> return ms;
> Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html >
> lwip-users mailing list
> [hidden email] > https://lists.nongnu.org/mailman/listinfo/lwip-users >