0

UDP on HD210



Hello,

I have a script that receives a UDP packet and it works fine on an HD2000 but doesn't work on the HD210. For the 2000 I name it autorun.bas and for the 210 it's named autorun.brs. Other than that it's exactly the same. Is there something else that needs to be done to get it to work on the HD210? I've included the script below.

Thanks,

Brian

nc = CreateObject("roNetworkConfiguration", 0)

nc.SetIP4Address("10.3.10.52")
nc.SetIP4Netmask("255.255.255.0")
nc.SetIP4Broadcast("10.3.10.255")
nc.SetIP4Gateway("10.3.10.1")
nc.Apply()


u=CreateObject("roUrlTransfer")
v=CreateObject("roVideoMode")
v.SetMode("800x600x75p")
p=CreateObject("roMessagePort")
i=CreateObject("roImagePlayer")
i.DisplayFile("Energy0.bmp")
v1=CreateObject("roVideoPlayer")
udp=CreateObject("roDatagramReceiver", 21075)
udp.SetPort(p)


ListenLoop:
msg=wait(0,p)

if type(msg) = "roDatagramEvent" then
if msg = "STOP" then
v1.Stop()

else if msg = "PLAY" then
goto FlagLoop

endif
endif
goto ListenLoop


FlagLoop:


nc.SetDHCP()
nc.Apply()

u.SetUrl("http://artfiles.art.com/images/-/USA-Flag-Poster-C10084150.jpeg")
u.SetPort(p)
u.AsyncGetToFile("flag.jpg")

url_loop:
msg=wait(0,p)
if type(msg)="roUrlEvent" then
if (msg.GetInt() = 1) then goto displayFlag
endif
goto url_loop

displayFlag:
i.DisplayFile("flag.jpg")

LoopLoop:
goto LoopLoop

3 comments

  • 0
    Avatar
    RokuLyndon


    What firmware version are you using?



    I've noticed an issue with the UDP comparison that might not be fixed yet. Assuming your commands are always 4 digits, make the following change:



    if left(msg,4) = "STOP" then



    else if left(msg,4) = "PLAY" then





    The comparison will only be done on the first 4 digits of the string.
  • 0
    Avatar
    ba_hill


    Hi,



    I just upgraded to version 3.1.73. It didn't work with 3.1.46 either, though. I'll change my script as you suggested and  let you know if that works.



    Thanks,



    Brian
  • 0
    Avatar
    ba_hill


    Hi Lyndon,



    Thanks! That fixed it.



    Brian
Please sign in to leave a comment.