Hi,

Although I have not implemented the following in the HTTP server I am using (I 
think I should)

think about it.


Normal HTTP flow:

Browser sends a request to server

Server responds and closes the connection.


On LwIP side when you close a connection using the tcp_close it closes ALL.


From having problems in some TCP module that I wrote I found that if I call 
tcp_shutdown and only

define shutdown the TX side the connection is closed only after getting the ACK.


This way transmit is closed but RX is a live and can respond to a FIN etc...


Try replacing the tcp_close with  tcp_shutdown(pcb, FALSE, TRUE);

The above will close the TX side only.


Here is a similar problem:  
http://www.reactos.org/pipermail/ros-diffs/2013-April/048568.html



Hope that helped... please update us [😊]


BR,

Noam.



________________________________
From: lwip-users <lwip-users-bounces+noam=silrd....@nongnu.org> on behalf of 
花生壳用户 <lbg...@163.com>
Sent: Friday, August 5, 2016 5:56 AM
To: lwip-users@nongnu.org
Subject: [lwip-users] http server problems/bug

With more infomation provided, I re-post it here(I post it through nabble 
before), sorry for that.

Problem,

 web server                       <------ GET  HTTP/1.1-----   web Client
 web server (FIN_WAIT_1)  -------- FIN,PSH----------->   web Client
 web server (FIN_WAIT_2)  <-------- ACK-------------      web Client
 (sometimes ACK not received by web server !!  we find it does not enter 
FIN_WAIT_2 state, but the low_level_input actually received the ‘ACK’ )

 web server                     <-------- FIN--------------      web Client
 web server                      -------- ACK------------->      web Client
 (......some time like half minutes later, re-transmission occurs)
 web server                        --------FIN,PSH------->       web client
 web server                       <------RST-------------         web client

 (it seems the whole pcb(tcp_pcb) is reset ! Because all other connections fail 
,including tcp client which is an independent thread )
Then after a long time(even minutes later), all connection recovered.


Testing Conditions,
Lwip 1.4.1 ,   web server is based on example of ‘httpserver_raw’, with much 
more communication throughput, also with some dynamic web pages.
web server is inside the tcpip_thread  rather than an independent thread.

we can ensure that all the APIs is called properly in our multithreaded system.

we have tested all of our lwip related applications, like  tcp client, tcp 
server, udp, sntp, which are running in our system at the same time, for 
several weeks , all ok, except for web server. we also have tried the web 
server alone,without other applications in our system,but result is the same.

Some PC occurs much more frequently while others seldom occurs.

web server(MCU,STM32) IP :  192.168.0.10
web client(PC,IE browser) IP:  192.168.0.14

wireshark capture file 'wireshark.pcapng' is attached.



Our doubts,
1. Why the upper level didn’t receive ‘ACK’ while low_level_input did?
2. In http server application, how to avoid reseting the whole tcp pcb(if my 
analysis is right) when ACK is really missing from the low level hardware(it 
happens under poor environment, right?)

Any advice is really appreciated !





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

Reply via email to