Forum > Networking and Web Programming

listen broadcast message

(1/3) > >>

ProfHarry:
Hello,
I have several ESP32s on a network which send broadcast messages (ASCII texts of 20 to 30 characters) at more or less regular intervals.

What is the easiest way for a beginner to recover these messages in a lazarus application?
Could you give me an example?

Thanks

Thaddy:
There is a great example I got from Stackoverflow that should be just he ticket for you:
https://stackoverflow.com/questions/9786011/delphi-synapse-udp-client-server

It uses synapse, but it is light enough. I can probably convert it to fcl-web if required.

ProfHarry:
Thanks,

If I've understood correctly, I'm only using the client part. Is that correct?
I'll take a look at that and probably come back with my newbie questions.

Thaddy:
It depends on you having control over the software from the esp32's.
Since you mentioned broadcasting, I assume the protocol to be UDP, but you can also do that differently as long as it is socket based. But indeed, basically you only need a listener.
Take the echo example from stack overflow as an example: instead of echo, you log the identity from the ESP32's and its messages. That takes very few changes to the code.

MarkMLl:

--- Quote from: Thaddy on June 05, 2024, 08:25:47 am ---Since you mentioned broadcasting, I assume the protocol to be UDP, but you can also do that differently as long as it is socket based. But indeed, basically you only need a listener.
Take the echo example from stack overflow as an example: instead of echo, you log the identity from the ESP32's and its messages. That takes very few changes to the code.

--- End quote ---

Note that UDP broadcasts are generally discarded by routers.

MarkMLl

Navigation

[0] Message Index

[#] Next page

Go to full version