创建多个httpd服务器时,只能访问其中一个,第二个无法访问

DJZ1992
Posts: 72
Joined: Fri Jul 09, 2021 9:15 am

创建多个httpd服务器时,只能访问其中一个,第二个无法访问

Postby DJZ1992 » Mon Mar 28, 2022 4:52 am

创建了多个httpd服务器。80、81和89三个端口

I (5207) app_httpd: Starting stream server on port: '81'
D (5217) httpd: httpd_thread: web server started
D (5217) httpd_uri: httpd_register_uri_handler: [0] installed /stream
D (5217) httpd: httpd_server: doing select maxfd+1 = 59

I (5227) app_httpd: [1605]:Starting OTA server on port: '89'
D (5237) httpd: httpd_thread: web server started
D (5237) httpd_uri: httpd_register_uri_handler: [0] installed /ota
D (5237) httpd: httpd_server: doing select maxfd+1 = 62
D (5257) httpd_uri: httpd_find_uri_handler: [0] = /ota

访问80,可以打开web,访问81也可以。
但是访问89打不开,为什么呢?

D (43277) httpd: httpd_server: processing listen socket 60
W (43287) httpd: httpd_accept_conn: error in accept (23)
W (43287) httpd: httpd_server: error accepting new connection
D (43287) httpd: httpd_server: doing select maxfd+1 = 62
D (43897) httpd: httpd_server: processing listen socket 60
W (43897) httpd: httpd_accept_conn: error in accept (23)
W (43897) httpd: httpd_server: error accepting new connection
D (43897) httpd: httpd_server: doing select maxfd+1 = 62
D (43967) httpd: httpd_server: processing listen socket 60
W (43967) httpd: httpd_accept_conn: error in accept (23)
W (43967) httpd: httpd_server: error accepting new connection
D (43977) httpd: httpd_server: doing select maxfd+1 = 62
D (43987) httpd: httpd_server: processing listen socket 54
D (43987) httpd_sess: httpd_sess_close_lru: Closing session with fd 63
D (43997) httpd: httpd_server: doing select maxfd+1 = 64
D (43997) httpd: httpd_server: processing ctrl message
D (43997) httpd: httpd_process_ctrl_msg: work
D (44007) httpd_sess: httpd_sess_delete: fd = 63
D (44017) httpd_sess: httpd_sess_delete: active sockets: 0
D (44017) httpd: httpd_server: processing listen socket 54
D (44027) httpd: httpd_accept_conn: newfd = 63
D (44027) httpd_sess: httpd_sess_new: fd = 63
D (44027) httpd_sess: httpd_sess_new: active sockets: 1
D (44037) httpd: httpd_accept_conn: complete
D (44037) httpd: httpd_server: doing select maxfd+1 = 64
D (44977) httpd: httpd_server: processing listen socket 60
W (44987) httpd: httpd_accept_conn: error in accept (23)
W (44987) httpd: httpd_server: error accepting new connection
D (44987) httpd: httpd_server: doing select maxfd+1 = 62

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: 创建多个httpd服务器时,只能访问其中一个,第二个无法访问

Postby ESP_YJM » Mon May 09, 2022 11:53 am

你试试把 CONFIG_LWIP_MAX_SOCKETS 调大一点。

DJZ1992
Posts: 72
Joined: Fri Jul 09, 2021 9:15 am

Re: 创建多个httpd服务器时,只能访问其中一个,第二个无法访问

Postby DJZ1992 » Tue May 10, 2022 1:25 am

ESP_YJM wrote:
Mon May 09, 2022 11:53 am
你试试把 CONFIG_LWIP_MAX_SOCKETS 调大一点。
默认是10,这个10跟多个httpd服务器之间的关系有什么说法?

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: 创建多个httpd服务器时,只能访问其中一个,第二个无法访问

Postby ESP_YJM » Tue May 10, 2022 1:51 am

每个 httpd 服务器会占用起码 3 个左右的套接字,如果再有客户端连接,每个客户端就会占用一个,套接字总数就是由 CONFIG_LWIP_MAX_SOCKETS 决定的,数量不够了就无法访问了。

DJZ1992
Posts: 72
Joined: Fri Jul 09, 2021 9:15 am

Re: 创建多个httpd服务器时,只能访问其中一个,第二个无法访问

Postby DJZ1992 » Thu May 12, 2022 8:25 am

ESP_YJM wrote:
Tue May 10, 2022 1:51 am
每个 httpd 服务器会占用起码 3 个左右的套接字,如果再有客户端连接,每个客户端就会占用一个,套接字总数就是由 CONFIG_LWIP_MAX_SOCKETS 决定的,数量不够了就无法访问了。
好的,谢谢

Who is online

Users browsing this forum: No registered users and 33 guests