Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 3.6 UDP broadcast

  1. #1

    Teensy 3.6 UDP broadcast

    I have been attempting a UDP broadcast using the Teensy Ethernet library (Teensy 3.6 with Wiz8820io). I want to broadcast a UDP packet to a local subnet by using an IP address such as 192.168.0.255, the core of my code looks something like this..

    IPAddress broadcastIp(192,168,0,255);

    EthernetUDP UDP;

    void setup()
    {
    char tmp[30];

    UDP.begin(30305);
    strcpy(tmp,"Hello from 192.168.0.140");

    UDP.beginPacket(broadcastIp,30304);
    UDP.write(tmp);
    UDP.endPacket();
    }

    If I use the broadcastIp address as 192.168.0.3 the target gets the packet across the network, if however I use 192.168.0..255 there is nothing received. In fact using Wireshark I can see that the Teensy never transmits a UDP packet whenever the broadcast address is used (It transmits the fully qualified IP address packet fine). Is this a library issue and does someone have fix or am I missing something very fundamental

    Regards, Roger d

  2. #2
    Shouldn't you be calling beginMulticast instead of begin?

  3. #3
    Thanks Ryan but it turns out I was the culprit. I was recovering my subnet mask from Eeprom and it was incorrect, fixed it and tidied up my libraries, it work as expected now. A bit older and wiser now.
    Regards. Roger d

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •