简体   繁体   English

ESP32 - ESPAsyncWebServer - server.client()?

[英]ESP32 - ESPAsyncWebServer - server.client()?

I am working on the ESP32 at the moment, and I need to integrate a new part in my already made program, the problem is that in my program I use a: AsyncWebServer, and this new part (camera ) works with: ESP32WebServer, so I try to integrate the camera is to make it work with my already programmed server, but I am stuck on this line:我目前正在研究 ESP32,我需要在我已经制作的程序中集成一个新部分,问题是在我的程序中我使用的是:AsyncWebServer,而这个新部分(相机)适用于:ESP32WebServer,所以我尝试集成相机是为了让它与我已经编程的服务器一起工作,但我被困在这条线上:

#include <ESP32WebServer.h> <---- #include <ESPAsyncWebServer.h>

ESP32WebServer server (80); ESP32WebServer 服务器(80); <----- AsyncWebServer server (80); <----- AsyncWebServer 服务器 (80);

WiFiClient client = server.client (); WiFiClient client = server.client(); <-----??? <-----???

I can't find the equivalent of: server.client () when I use: AsyncWebServer.当我使用:AsyncWebServer 时,我找不到对应的:server.client()。

Thanks for any suggestions.感谢您的任何建议。

That's because ESPAsyncWebServer doesn't use WiFiClient objects.那是因为ESPAsyncWebServer不使用WiFiClient对象。

WiFiClient is a poorly named interface to a raw TCP connection. WiFiClient是原始 TCP 连接的名称不佳的接口。 ESPAsyncWebServer doesn't use WiFiClient , it uses AsyncTCP instead, which is where its asynchrony derives from (plus a lot of work in the web server itself). ESPAsyncWebServer不使用WiFiClient ,而是使用AsyncTCP ,这是其异步性的来源(加上 web 服务器本身的大量工作)。

It has a client() method, but that method returns an AsyncClient object.它有一个client()方法,但该方法返回一个AsyncClient object。 That's the closest you're going to get to getting a WiFiClient .这是您最接近获得WiFiClient的方法。 Don't expect it to work exactly the same way or have exactly the same methods.不要期望它以完全相同的方式工作或具有完全相同的方法。

If you want to use the camera software with the async web server, you'll need to rewrite the camera software to work with it, or run a second web server on a different port number.如果您想将相机软件与异步 web 服务器一起使用,您需要重写相机软件以使用它,或者在不同的端口号上运行第二个 web 服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 两个服务器在同一个 ESP32 程序上? ESPAsyncWebServer 和 ESP32WebServer - Two server on the same ESP32 program ? ESPAsyncWebServer and ESP32WebServer 在 ESP32 客户端和服务器之间发送数据 - Sending Data Between ESP32 Client and Server esp32 中的网络套接字 - websocket in esp32 ESP32上的Web服务器:如何自动更新和显示服务器的传感器值? - Web server on ESP32: How to update and display sensor values from the server automatically? 无法从 VUE 向 ESP32 https 服务器发出 POST 请求 - Can´t make POST request from VUE to ESP32 https server 如何在 ESP32 应用程序中使用 ajax 脚本解析 json - How to parse json using ajax script in ESP32 app 使用 javascript 向 esp32 接入点发送消息 - Sending a message to esp32 access point with javascript 如何将 CORS-Header 添加到我的 esp32 网络服务器 - How to add CORS-Header to my esp32 webserver 基于延迟承诺的多文件上传处理,在 for 循环中使用 javascript 到使用 ajax 的 esp32 - Deferred promise based multiple file upload handling with javascript in a for loop to an esp32 with ajax 使用 js(使用 ESP32)在网站上实时从 firebase 获取传感器值 - Getting sensor-values from firebase realtime down on website using js (using ESP32)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM