Forum Discussion

jbrave's avatar
jbrave
Channel Surfer
14 years ago

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

4 Replies

  • "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.
  • jbrave's avatar
    jbrave
    Channel Surfer
    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
  • "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
  • jbrave's avatar
    jbrave
    Channel Surfer
    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