[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] STM32F4 LwIP HTTP Ethernet Bootloader (IAP)
From: |
Müller , Martin , KN |
Subject: |
Re: [lwip-users] STM32F4 LwIP HTTP Ethernet Bootloader (IAP) |
Date: |
Fri, 14 Feb 2014 08:38:37 +0000 |
Hey,
Thank you very much. It works ;)
Martin
-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von robin
Gesendet: Mittwoch, 5. Februar 2014 16:26
An: address@hidden
Betreff: Re: [lwip-users] STM32F4 LwIP HTTP Ethernet Bootloader (IAP)
Hi Martin,
Looking at http://lwip.wikia.com/wiki/Raw/TCP the bottom of the page has
session termination, scenario 2, local server shutdown (which is what you're
doing).
You can see that calling tcp_close() does what I had indicated - it sends a FIN.
So on receipt of a checksum invalid packet you would do tcp_write(http
response); tcp_output() to force all the data to be sent; tcp_close() to send
the FIN.
Your client has the choice to process the http response when it wishes; nothing
about tcp_close() forces the other end to stop sending - it's just saying you
won't be sending any more data.
It appears that your client chooses to continue sending some (large) amount of
data, perhaps because it is all in a buffer already on the host operating
system.
Your only option to make the client close faster is to use tcp_abort(), which
will send a RST to the other end.
Whether or not this causes the sort of graceful error handling you want depends
on the client. Why not try it?
Cheers,
Robin
On 2014-02-05 12:25, Müller wrote:
> Hi Robin,
>
> Thanks for your fast answer. As conclusion, I'll show you my debug
> stream:
>
> Let's cause the following case: While flashing packet 1, the
> Bootloader detects a wrong checksum. It sends the ErrorPage and when
> it is confirmed by tcp_sent() callback, it closes the connection. But
> this seems to take too long, because the browser client won't stop
> sending tcp-packets. This is a problem, because when sending a larger
> file (~1500 packets) it paralyses the server so that the browser
> cannot display the ErrorPage immediately.
>
> Do you mean sending the errorpage with FIN-Flag set? How is this
> possible?
>
> Thank you very much,
>
> Martin
>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n> Bootloader 2:
> Erasing Flash ... Done. Time: 4531 ms.<\n> Bootloader 2: Flashing
> packet 1 ...Parser: Line: 345, Checksum: 0xf3 ERROR! <\n> Process
> stopped.<\n>
> tcp_close: closing in State: ESTABLISHED<\n>
> **** PLEASE STOP HERE, but it won't ;( ****
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n>
> tcp_recved: recveived 1460 bytes, wnd 5840 (0).<\n> TCP connection
> closed: FIN_WAIT_2 52638 -> 80.<\n> tcp_pcb_purge<\n>
> tcp_recved: recveived 932 bytes, wnd 5839 (1).<\n>
> tcp_close: closing in State: TIME_WAIT<\n>
> tcp_slowtmr: no active pcbs<\n>
>
> -----Ursprüngliche Nachricht-----
> Von: Robin Iddon [mailto:address@hidden
> Gesendet: Mittwoch, 5. Februar 2014 09:36
> An: Müller, Martin, KN
> Betreff: Re: [lwip-users] STM32F4 LwIP HTTP Ethernet Bootloader (IAP)
>
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users