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

roku ip address

Question, with roDeviceInfo, is ethernet always eth0 and wifi always eth1? Is there only one ever active, or can both wifi and ethernet be active on a box?

It appears to be either or, but on *nix systems, I've seen device names change on reboot...

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
4 REPLIES 4
gonzotek
Visitor

Re: roku ip address

"jbrave" wrote:
Question, with roDeviceInfo, is ethernet always eth0 and wifi always eth1? Is there only one ever active, or can both wifi and ethernet be active on a box?

It appears to be either or, but on *nix systems, I've seen device names change on reboot...

- Joel
I can't answer as to which is which(or if it's possible for them to change), but can say definitely that only one is active at a time.
Remoku.tv - A free web app for Roku Remote Control!
Want to control your Roku from nearly any phone, computer or tablet? Get started at http://help.remoku.tv
by Apps4TV - Applications for television and beyond: http://www.apps4tv.com
0 Kudos
jbrave
Channel Surfer

Re: roku ip address

if anyone is interested, here is a little code for grabbing an ipaddress from roDeviceInfo.

function getrokulocalip() as string
di=createobject("rodeviceinfo")
while true
temp=di.getipaddrs()
temp.reset()
aakey=temp.next()
if not temp=invalid then
return temp[aakey]
end if
end while
end function
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
TheEndless
Channel Surfer

Re: roku ip address

"jbrave" wrote:
if anyone is interested, here is a little code for grabbing an ipaddress from roDeviceInfo.

function getrokulocalip() as string
di=createobject("rodeviceinfo")
while true
temp=di.getipaddrs()
temp.reset()
aakey=temp.next()
if not temp=invalid then
return temp[aakey]
end if
end while
end function

Hrmm.. that doesn't look quite right. You're resetting temp on every loop through that while, so the .Next() is never actually going to get you anywhere. That aside, with an associative array, you can do a "For Each" through the keys in the aa instead of the "While" loop...
Function GetRokuLocalIP() As String
deviceInfo = CreateObject("roDeviceInfo")
ipAddresses = deviceInfo .GetIPAddrs()
For Each key In ipAddresses
ipAddress = ipAddresses[key]
If ipAddress <> invalid And ipAddress.Len() > 0 Then
Return ipAddress
End If
Next
Return ""
End Function
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jbrave
Channel Surfer

Re: roku ip address

You are right - both the createobject and reset should happen before the start of the loop. It still works, but, it isn't "right" and would fail under other circumstances.

I didn't know you could do a for-each on an AA. That is huge.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
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.