当前位置:网站首页>[network protocol] problems and solutions in the use of LwIP
[network protocol] problems and solutions in the use of LwIP
2022-06-13 00:42:00 【A small snail in a big city】
List of articles
- Preface
- 1. LWIP-HTTP Unable to maintain long connection
- 2. a large number of TIMEWAIT Cause resource exhaustion
- 2.1 problem
- 2.2 reason
- 2.3 Solution
- 2.4 knowledge
- 2.4.1 TCP/IP Detailed explanation --TCP Connecting TIME_WAIT Too many states
- 2.4.2 TCP stay FIN_WAIT1 How long can the state last and TCP False connection problem
- 2.4.3 TCP agreement RST:RST Introduce 、 When to send RST package
- 2.4.4 Why does the server suddenly reply RST—— Be careful of the security devices in the network
- 2.4.5 Graphic network | received RST, It will disconnect TCP Is it connected ?
- summary
Preface
Doing it IOT Equipment is often used LWIP Open source TCP/IP Protocol library , The problem is hereby recorded and the solution
1. LWIP-HTTP Unable to maintain long connection
1.1 problem
Developing http When the server provides data to the front end , Web page loading will fail , stay http_accepet In the function, you will see , The browser will always make requests , Cause protocol stack overflow .
The front end initiates a js There is no problem when requesting , But launching more than a dozen requests is different in succession js request , It's always reconnecting , And there is almost no time to wait , This will cause http Server busy , Resources are exhausted and then down .
- Solution retention http A long connection ,http_accept Just enter once
- Solve the problem that the browser requests the next time after receiving the complete static page data
1.2 analysis
- understand http Protocol and how the front-end browser works , The following two articles document how the server side and browser side work , It's what I want .
HTTP Protocol request header and response header
Talking about Http Long connection and Keep-Alive as well as Tcp Of Keepalive
- according to 1 Chinese saying , To understand the browser, you need to know how much text is transmitted at a time , To determine whether this connection is over .
- To maintain a long connection , The response header must contain connetion:persistant, It seems that mine doesn't
1.3 knowledge
Remember a Content-Length The murder that started
2. a large number of TIMEWAIT Cause resource exhaustion
2.1 problem
In the use of LWIP Development IOTdev when , I assigned 10 individual PCB, But because TIMEWAIT stay LWIP Wait for 60 second , It's too long , Because my equipment may be in 16 Use quickly in seconds 16 Different PCB block , This always leads to insufficient resources , Cannot connect to program .
2.2 reason
- It is found that the web page has not established a long connection , Because there is RTC Every time 1s Polling consumes each time PCB, stay TIMEWIAT Waiting in the 60s, Obviously it took too long , Not enough resources .
- TIMEOUT It's too long , I think in the LAN 10s sufficient .

2.3 Solution
- take TCP_MSL Change to 100000UL/10s/
- increase MEMP_NUM_TCP_PCB To 30 individual
2.4 knowledge
2.4.1 TCP/IP Detailed explanation –TCP Connecting TIME_WAIT Too many states
TCP/IP Detailed explanation –TCP Connecting TIME_WAIT Too many states
2.4.2 TCP stay FIN_WAIT1 How long can the state last and TCP False connection problem
TCP stay FIN_WAIT1 How long can the state last and TCP False connection problem
2.4.3 TCP agreement RST:RST Introduce 、 When to send RST package
TCP agreement RST:RST Introduce 、 When to send RST package
2.4.4 Why does the server suddenly reply RST—— Be careful of the security devices in the network
Why does the server suddenly reply RST—— Be careful of the security devices in the network
2.4.5 Graphic network | received RST, It will disconnect TCP Is it connected ?
Graphic network | received RST, It will disconnect TCP Is it connected ?
summary
边栏推荐
- ucore lab2
- [vscode]todo tree a to-do plug-in
- [LeetCode]21. Merge two ordered linked lists twenty-nine
- Leetcode weekly -- April to May
- [supersocket 2.0] supersocket 2.0 from the beginning to the end
- What are the levels of safety accidents
- Some basic design knowledge
- Oceanbase is the leader in the magic quadrant of China's database in 2021
- ucore lab1
- @Disallowcurrentexecution prevents quartz scheduled tasks from executing in parallel
猜你喜欢
![[vscode]todo tree a to-do plug-in](/img/52/c977bc9cd021ca6fd12bcc22ae9f78.jpg)
[vscode]todo tree a to-do plug-in

Druid reports an error connection holder is null

1. Google grpc framework source code analysis Hello World

今日睡眠质量记录74分

Successfully installed opencv under delphixe

Daily buckle exercise - conclusion

Masa auth - overall design from the user's perspective

Composite key relationships using Sqlalchemy - relationships on composite keys using Sqlalchemy
![[CISCN2019 华北赛区 Day2 Web1]Hack World --BUUCTF](/img/1e/ebf8cc06ba620261f03f84ca2c68e6.png)
[CISCN2019 华北赛区 Day2 Web1]Hack World --BUUCTF

睡前小故事之MySQL起源
随机推荐
[vscode]todo tree a to-do plug-in
[supersocket 2.0] supersocket 2.0 from the beginning to the end
[LeetCode]13. Roman numerals to integers thirty
[GXYCTF2019]禁止套娃--详解
ImportError: cannot import name 'get_ora_doc' from partially initialized module
DNS attack surface analysis
为什么磁盘分区的时候,第一个分区前面总有一段空间(63或者2048个扇区)
Pipelines in go concurrency mode
哲學和文學的區別
What are the conditions of index invalidation?
也许尘埃落地,我们才能想清楚互联网的本质
今日在家休息
硬(磁)盘(二)
The difference between philosophy and Literature
Kotlin 协程的四种启动模式
Browser cache execution process
1115. alternate printing foobar
Daily buckle exercise - conclusion
Maya modeling VI
(01).NET MAUI实战 建项目