Current Lua downloadable firmware will be posted here

User avatar
By ArtWhaley
#33236 I'm trying to use a nodeMCU dev board with the most recent firmware to decode UDP packets from a lighting controller.

Viewing the packet in Wireshark I can confirm that it's all there - I'm getting 572 bytes and they're all correct and in the right place. When I run a UDP server on the nodMCU... I only see the protocol's ID field as plain text... 8 of the 572 bytes.

https://gyazo.com/6fb293c02d4a56d6ece9e7c3514a0b52 shows the wireshark packet... and here's my code:

Code: Select alls=net.createServer(net.UDP)
s:on("receive",function(s,c) print(c) end)
s:listen(5568)



What gets printed is simply "Art-Net" once per packet received. Do I need to do something differently to get or view the full binary data from the packet?
User avatar
By TerryE
#33455 c contains a mostly non-printable string , so when you print it you only see the printable characters. You can use crypto.toHex() if you are running a dev build or a roll-your-own like something like:
Code: Select allfunction strToHex(s)
  local bytes = {}
  for i=1,s:len()  do
    bytes[#bytes+1] = ('%2x'):format(s:byte(i,i))
  end
  return table.concat(bytes, ' ')
end