Page 1 of 1

TCP and UDP, How Do I Get Both?

Posted: Sat Mar 16, 2024 7:04 pm
by fester225
I'm coding for reception from potentially unanticipated WiFi sources for ESP32-WROOM-DA.

Can I use ESPAsyncWebServer for TCP and AsyncUDPPacket for UDP at the same time?

I know ESPAsyncWebServer is used separate HTTP transmissions from other protocols, but can it be used to directly access plain TCP transmissions?

Is there an ESPAsyncWebServer derivative which does UDP?

Re: TCP and UDP, How Do I Get Both?

Posted: Sun Mar 17, 2024 4:40 am
by lbernstone
You can certainly run both a web server and a udp endpoint at the same time on different ports. You will generally only have one protocol listener on any port. HTTP(s) is a stateful connection protocol, so it runs only on TCP. If you want a TCP listener on a random socket, and you are going to write a protocol handler for it yourself, you want to use the WiFiClient library.

Re: TCP and UDP, How Do I Get Both?

Posted: Sun Mar 17, 2024 1:48 pm
by PepeTheGreat
https://github.com/PepeTheFroggie/ESP32 ... webCAM_UDP

That is ESP32 video transferred by TCP. Http.
And RC commands sent via UDP to the same ESP32.

http video:
https://youtu.be/NCWrQaDqzJg
external video:
https://youtube.com/shorts/Xo_1b1SBKy8