TCP and UDP, How Do I Get Both?

fester225
Posts: 5
Joined: Tue Feb 27, 2024 3:54 pm

TCP and UDP, How Do I Get Both?

Postby fester225 » Sat Mar 16, 2024 7:04 pm

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?

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

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

Postby lbernstone » Sun Mar 17, 2024 4:40 am

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.

PepeTheGreat
Posts: 20
Joined: Mon Sep 18, 2023 3:54 am

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

Postby PepeTheGreat » Sun Mar 17, 2024 1:48 pm

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

Who is online

Users browsing this forum: Majestic-12 [Bot] and 49 guests