It's actually a lot easier than what you (and I) think (thought). I misspoke, you want to use roStreamSocket. Here's a little example of connecting to the Roku's own port 8080 where you'd run genkey, get some system information, or just send remote button presses:
Sub telnet()
print "telnet"
di = CreateObject("roDeviceInfo")
ipaddrs = di.GetIPAddrs()
if ipaddrs.eth0 <> invalid then
print "eth0"
ipaddr = ipaddrs.eth0
end if
if ipaddrs.eth1 <> invalid then
print "eth1"
ipaddr = ipaddrs.eth1
end if
print ipaddr
sa = CreateObject("roSocketAddress")
sa.setAddress(ipaddr+":8080")
print sa.getAddress()
ss = CreateObject("roStreamSocket")
print ss.setSendToAddress(sa)
print ss.getSendToAddress().getAddress()
cmd = "press" + chr(10) + "exit" + chr(10)
print ss.Connect()
print ss.SendStr(cmd)
sleep(1000)
print ss.ReceiveStr(1024)
print ss.Close()
sleep(1000)
print "Done"
End Sub
If you run this you should see something like:
telnet
eth0
192.168.0.120
192.168.0.120:8080
true
192.168.0.120:8080
true
11
1GS3DW050934 (Roku 3)
>h Home a A
u Up c B
d Down n Closed Caption
r Right g Game
l Left j Sleep
s Select ? Search
f,> Fwd [ Volume Down
b,< Rev ] Volume Up
p Play \ Volume Mute
y InstantReplay ^ Guide
i Info ! Power
k Back @ PowerOn
= Backspace # PowerOff
o PlayOnly + Channel Up
~ Input Source - Channel Down
t Stop ` Input Source Prev
m TellMe w Join
e Enter q1-q3 Preset1 - Preset3
:rgybe r=Red, g=Green, y=Yellow, b=Blue, e=Exit
*1234vtu
true
Done
I put in a lot of unnecessary prints to follow the action. All it does is send "press" and then "exit". You can telnet to port 8080 yourself and enter "press" to see what it spits out. Just make sure if you try to run this you're not already running telnet connected to port 8080.
I'm guessing if you've never created a channel/app and sideloaded it you'll have some questions about that. :smileyhappy: