UDP data not coming through

Hi All,

I'm just testing this code with an ESP8266 (Adafruit Feather Huzzah). It should send simple 'hello_world' via UDP to a raspberry pi...

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

#ifndef STASSID
#include "arduino_secrets.h" 
char ssid[] = SECRET_SSID;     // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
#endif

byte host[] = {xxx, xxx, x, x}; //redacted
int port = 8888;      // local port to listen on

// buffers for receiving and sending data
//char packetBuffer[UDP_TX_PACKET_MAX_SIZE + 1]; //buffer to hold incoming packet,
char  ReplyBuffer[] = "hello_world\r\n";       // a string to send back

WiFiUDP Udp;

void setup() {
  Serial.begin(9600);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print('.');
    delay(500);
  }
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());
  //Serial.printf("UDP server on port %d\n", localPort);
  //Udp.begin(localPort);
}

void loop() {
    delay(1000);
    // send message to the specified IP address and port
    int A = Udp.beginPacket(host, port);
    Serial.println("Sending UDP packet...");
    Serial.println(A); //returns 1 if udp.beginPacket is succesful, 0 if there is problem with supplied IP address or port.
    Serial.println(ReplyBuffer);
    Udp.write(ReplyBuffer);
    Udp.endPacket();
  }

Code compiles fine, connects to network and seems to be sending data once per second. Also returns A=1, indicating udp.beginPacket is successful.

I'm listening with Netcat on the RPi as follows:

nc -u -l localhost 8888

But I'm not getting anything through.

I can send data over netcat...

nc -u localhost 8888
hello world

comes through fine.

Any thoughts appreciated.

Thanks,

Chris

I used the WiFiUDPClient example from the WiFi library on an ESP32 and with the following line without localhost I received UDP messages.

nc -u -l 8888