Forum Discussion

GD13's avatar
GD13
Reel Rookie
8 months ago
Solved

is it possible to handle control bits coming from udp sockets?

pretty much title. I am trying to integrate a custom mDNS service into a project I am working on and am able to use a UDP socket to send and receive strings perfectly fine, however when I try to receive a message using a byte array it does not read anything. After a week of banging my head against a wall I have come up with the hypothesis that Roku's udp socket implementation does not support bytes that evaluate to null in ascii such as 0x00. I would really any input on this

  • Are you initializing the byte array?  I'm not sure if there's a way to create an roByteArray of a specific size without doing something like:

    ba = createObject("roByteArray")
    for i = 0 to 1000
       ba.Push(i)
    end for

    My quick and dirty test of creating ba without the initialization and using it with an roDatagramSocket doesn't receive any data.

2 Replies

  • renojim's avatar
    renojim
    Community Streaming Expert

    Are you initializing the byte array?  I'm not sure if there's a way to create an roByteArray of a specific size without doing something like:

    ba = createObject("roByteArray")
    for i = 0 to 1000
       ba.Push(i)
    end for

    My quick and dirty test of creating ba without the initialization and using it with an roDatagramSocket doesn't receive any data.

    • GD13's avatar
      GD13
      Reel Rookie

      you're a saint. this is the right answer, I was under the illusion that byte arrays could be dynamically sized...  I hate this language sometimes