Thanks Simon,
I too am not sure what changed under the covers but the behavior changed. In 
2.0.0 I could open a listening socket and bind it to port 80, get an accept 
socket, close the listening socket, process the HTTP request and then close the 
accept socked and open a new listening socket. This all worked fine. In 2.1.2 
when I went through the same process the bind failed after opening the 
listening socked after having closed after the accept with a reuse error. In 
reading about this it seems this is common in that it takes awhile to clear the 
resources of the original socket and you will get an error until this is 
complete. So in general I was doing it wrong in 2.0.0 but it worked anyway. The 
fix was to keep the listening socket and just close the accept socket after 
each HTTP request/response. This seems to work better although I have a lot 
more testing to do. I did not see this with Telnet or Modbus TCP because those 
sessions are kept until the client closes the connection.
Dan Sexton

-----Original Message-----
From: lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org 
<lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org> On Behalf Of Simon 
Goldschmidt
Sent: Thursday, August 10, 2023 2:55 PM
To: Mailing list for lwIP users <lwip-users@nongnu.org>; 
dwsex...@dwstech-llc.com
Subject: Re: [lwip-users] Problem with http connections

I'm not 100% sure what you think has changed, but the "reuseaddr" part should 
not have changed that much between 2.0.0 and 2.1.2 to result in this change.

Regards,
Simon

On 09.08.2023 21:35, dwsex...@dwstech-llc.com wrote:
> Found solution: Apparently in LWIP 2.0.0 you could bind a socket right 
> after closing it, so for a server if you created a socket, did  bind, 
> listen accept then send and then close you could not immediately 
> repeat the process without an address in use error even if the socket 
> options were set to reuse address. I fixed this in 2.1.2 by keeping 
> the bound listening socket and continued to use it to accept new 
> connections on the same port (port 80). My little Web server now work again 
> with 2.1.2.
> It took a little bit to find this as I w2as not expecting this change 
> in behavior but once I noticed that the bind was failing with an 
> address reuse error and a little digging I figured out how to correct it.
>
> *From:*lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org
> <lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org> *On Behalf Of 
> *dwsex...@dwstech-llc.com
> *Sent:* Thursday, August 3, 2023 8:30 AM
> *To:* 'Mailing list for lwIP users' <lwip-users@nongnu.org>
> *Subject:* Re: [lwip-users] Problem with http connections
>
> Correction, the upgrade was to 2.1.2 not 2.0.2.
>
> Dan Sexton
>
> *From:*lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org
> <mailto:lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org>
> <lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org
> <mailto:lwip-users-bounces+dwsexton=dwstech-llc....@nongnu.org>> *On 
> Behalf Of *dwsex...@dwstech-llc.com <mailto:dwsex...@dwstech-llc.com>
> *Sent:* Thursday, August 3, 2023 8:06 AM
> *To:* lwip-users@nongnu.org <mailto:lwip-users@nongnu.org>
> *Subject:* [lwip-users] Problem with http connections
>
> I have a product based on the STM32F407 that has been working since 
> 2017. It has both a home brew web server and a telnet server both 
> using LWIP to listen for clients.
>
> The product uses LWIP 2.0.0 and I recently tried to upgrade to LWIP
> 2.0.2 but some issues have popped up. During the upgrade I did not 
> change any of my application code.
>
> The Telnet server still works just fine, accepts connections and 
> communicates as expected.
>
> However, the Web Server listening on port 80 no longer works, 
> connections seem to be rejected. Both Telnet and the web server share 
> the same code for setting up the server (different ports of course), 
> listening for and accepting connections. Is there something in 2.0.2 
> the intercepts port 80 traffic or http requests, possibly a new option 
> that needs to be turned off? I searched the reflector and did not see 
> anything, a google search didn’t turn up anything as well.  I can 
> share a wireshark trace but I suspect the answer is simpler than 
> setting that up. I also have a Modbus TCP server running but have not 
> even tried that yet as I can’t get passed testing the web server.
>
> Thanks
>
> Dan Sexton
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to