Here is my code that I implemented from your suggestions. I broadcasted a message from my linux computer and wt32-eth01 never saw it. I confirmed with wireshark. I was unsure of myDNS IP address. What should DNS be?
I started with UDPSendReceiveString example.
I only see my mac address printed during the loop.
See code below:
#include <Ethernet.h>
//#include <EthernetUdp.h>
#include <WebServer_WT32_ETH01.h>
// The IP address will be dependent on your local network:
IPAddress myIP(192, 168, 86, 177);
IPAddress myGW(192, 168, 86, 1);
IPAddress mySN(255, 255, 255, 0);
IPAddress myDNS(8, 8, 8, 8);
uint64_t chipid;
unsigned int localPort = 65000; // local port to listen on
// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; // buffer to hold incoming packet,
char ReplyBuffer[] = "acknowledged"; // a string to send back
// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
void setup() {
chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).
WT32_ETH01_onEvent();
ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER);
// Static IP, leave without this line to get IP via DHCP
ETH.config(myIP, myGW, mySN, myDNS);
WT32_ETH01_waitForConnect();
// Open serial communications and wait for port to open:
Serial.begin(115200);
Serial.printf("ESP32 Chip ID = %04X\n",(uint16_t)(chipid>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
// start UDP
Udp.begin(localPort);
Serial.println("setup done");
Serial.println(localPort);
}
void loop() {
// if there's data available, read a packet
Serial.printf("ESP32 Chip ID = %04X\n",(uint16_t)(chipid>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
int packetSize = Udp.parsePacket();
if (packetSize) {
Serial.print("Received packet of size ");
Serial.println(packetSize);
Serial.print("From ");
IPAddress remote = Udp.remoteIP();
for (int i=0; i < 4; i++) {
Serial.print(remote[i], DEC);
if (i < 3) {
Serial.print(".");
}
}
Serial.print(", port ");
Serial.println(Udp.remotePort());
// read the packet into packetBufffer
Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
Serial.println("Contents:");
Serial.println(packetBuffer);
// send a reply to the IP address and port that sent us the packet we received
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write(ReplyBuffer);
Udp.endPacket();
}
delay(1000);
}