UDP Broadcast address problem



  • If I use an address of say 192.168.1.255 with udp.send to broadcast a message to my subnet, or anything ending in 255, I am getting the following

    Error: EACCES (permission denied)
    

    Specific non broadcast IP address do work.. and RX is working OK from broadcast. What am I doing wrong ?



  • Thanks and apologies Emil - you have no idea how many times I read the API details - and missed that aspect. Working now.

    Great job with this API - just another vote for MQTT client support in the future


  • FlicTeam

    What you should do is to first call bind, followed by setBroadcast(true) on the socket. Then you can send messages using send.
    FYI, the API is made to be compatible with Node.js API https://nodejs.org/api/dgram.html.


Log in to reply