Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
GD13
Reel Rookie

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

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
renojim
Community Streaming Expert

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

Jump to solution

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.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.

View solution in original post

0 Kudos
2 REPLIES 2
renojim
Community Streaming Expert

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

Jump to solution

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.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
GD13
Reel Rookie

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

Jump to solution

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

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.