ESP32 UDP - WiFiUDP how to send bytes using udp protocol?

avi007
Posts: 11
Joined: Fri May 26, 2017 12:58 am

ESP32 UDP - WiFiUDP how to send bytes using udp protocol?

Postby avi007 » Wed Jun 07, 2017 1:05 am

Hi,

I am trying to use WiFiUDP class. When I try to send the data using the function wifiudp.write(buf, l), I get compiler error. Which says:

error: macro "write" requires 3 arguments, but only 2 given wifiudp.write
https://github.com/espressif/arduino-es ... /WiFiUdp.h
Do you have any ideas why this happening, it somehow bypassing the overloaded function in WiFiUDP class and going straight to lwip macro ?

Please let me know if you know why this happening, what am I missing.

Objective is to send the byte packets via UDP. Please note that I can send the data fine if I use wifiudp.printf function. I would prefer to send bytes.

Thanks,
Avi

dandan
Posts: 1
Joined: Fri Jul 28, 2017 7:09 pm

Re: ESP32 UDP - WiFiUDP how to send bytes using udp protocol?

Postby dandan » Fri Jul 28, 2017 7:18 pm

I noticed, that in the esp-idf repository on github there is a macro named "write", which takes 3 arguments. You can find it in /components/lwip/include/lwip/lwip/sockets.h at line 561. https://github.com/espressif/esp-idf/bl ... /sockets.h

This #define interferes with the mehtod "write" as decalred in WiFiUdp.h. The compiler takes the macro from sockets.h rather than the WiFiUdp one.

I only encountered this problem when I explicitly #include the sockets.h in an Arduino project.

To work around this problem I would manually change the name of the method "write" in the WiFiUdp files.

Kind regards

Who is online

Users browsing this forum: No registered users and 86 guests