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: 
MrLlama
Channel Surfer

roStreamSocket documentation example has a bug

The roStreamSocket "echo server" example contains a bug.  Specifically, when the socket IDs happen to be over 8 digits long, the `Str(socket_id)` representation loses precision because it uses scientific notation.  Given that subsequent connections usually have similar socket IDs, this can lead to different connections having the same stringified representation:

Brightscript Debugger> ? connection.GetID()
 87031812

Brightscript Debugger> ? Str(connection.GetID())
 8.703181e+07

Brightscript Debugger> ? connection.GetID().ToStr()
87031812

Note that in the above example, the Str() result is missing the final "2" digit.

0 Kudos
3 REPLIES 3
RokuPam
Streaming Star

Re: roStreamSocket documentation example has a bug

Hi @MrLlama,

Thanks for your feedback and reporting this documentation error! Where exactly in the documentation are you seeing this error? I took a look at the article, but was unable to find an instance of scientific notation (rather than the full string). 

0 Kudos
MrLlama
Channel Surfer

Re: roStreamSocket documentation example has a bug

The issue isn't that the article itself uses scientific notation, it's that it fails to account for Str(some_big_number) returning a string in scientific notation.  This causes a loss of precision and can cause multiple connections with different IDs to end up with the same Str(connection_id).

0 Kudos
RokuPam
Streaming Star

Re: roStreamSocket documentation example has a bug

Thank you for clarifying! We've created a ticket with the responsible engineering team to investigate further. 

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.