EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014
12:35 AM
Is localhost/127.0.0.1 supported?
Somehow i seem to remember that Roku cannot connect to itself at localhost or even 127.0.0.1 (loopback interface). And the roDeviceInfo.getIPAddrs() seems to hint as if it were the case:
But for grins i tried tonight and seems ECP work with both localhost and 127.0.0.1! It's easier that way... am i in the clear to use localhost or am i missing something?
"getIPAddrs()" wrote:
[...] Provides a way for your application to get the local IP address of the Roku box. This can be used in conjunction with the ECP (see the External Control Protocol Guide) command "launch" to start a different channel from the current channel.
But for grins i tried tonight and seems ECP work with both localhost and 127.0.0.1! It's easier that way... am i in the clear to use localhost or am i missing something?
4 REPLIES 4

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014
11:45 AM
Re: Is localhost/127.0.0.1 supported?
127.0.0.1 should work on newer devices, and localhost as an alias seems to work...sometimes. On legacy 3.1 devices you will need to check to see which interface has a valid ip and then use that address.
- Joel
- Joel
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014
12:37 PM
Re: Is localhost/127.0.0.1 supported?
Oh shucks. It was too good to be true, localhost fails on fw3 indeed. Instead this should do it, i hope?
IP = createObject("roDeviceInfo").getIpAddrs()[0] 'neat: sets IP to invalid if returned array is empty

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014
01:31 PM
Re: Is localhost/127.0.0.1 supported?
"EnTerr" wrote:
Oh shucks. It was too good to be true, localhost fails on fw3 indeed. Instead this should do it, i hope?IP = createObject("roDeviceInfo").getIpAddrs()[0] 'neat: sets IP to invalid if returned array is empty
I don't think that will work. GetIPAddrs returns an associative array, not an array, so there is no index "0". The keys are "eth0" and "eth1". Which is populated depends on if the box is connected wirelessly or not.
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2014
04:31 PM
Re: Is localhost/127.0.0.1 supported?
"TheEndless" wrote:
I don't think that will work. GetIPAddrs returns an associative array, not an array, so there is no index "0".
Yeah, shame on me for posting before testing :oops:
Last night i was doing it like so
ipAA = createObject("roDeviceInfo").getIpAddrs()but on back of my mind was bothering me ip may remain un-initialized and i also like shorter and self-maintaining code, as possible. This morning for some reason i thought i can go shorter. Could it be true that night owls are wiser?
for each eth in ipAA:
ip = ipAA[eth]
end for
I posted and lunchtime went to the park to get some exercise skating, where it dawned on me numeric indexing won't work. It's amusing, my thinking seems clearer away from the computer during unrelated activities. I rushed on my phone to the forums to delete my mistake... too late. Anyway, ifEnum is what i was thinking, something like (alas, lame) this :
IPs = createObject("roDeviceInfo").getIpAddrs()
IPs.reset()
ip = IPs[IPs.next()]