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

Write IP to tmp

Attempting to use the roDeviceInfo to get an IP Address from the Roku and write it to a tmp file. I have the following:

di= CreateObject("roDeviceInfo")
WriteAsciiFile("tmp:/iploc.txt", di.GetIPAddrs())


When I run this I get a type mismatch on the WriteAsciiFile line. Not sure what the problems is. Any ideas or suggestions appreciated.
Thanks
0 Kudos
4 REPLIES 4
TheEndless
Channel Surfer

Re: Write IP to tmp

WriteAsciiFile requires a string. GetIPAddrs() returns an associative array, where "eth0" is the wired IP address, and "eth1" is the wireless IP address.
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
btpoole
Channel Surfer

Re: Write IP to tmp

Is there a way to write the ip to a txt file which is located on my server? I understand what you are saying about the array and string. I have been able to isolate the value of eth1 but when I attempt to use WriteAsciiFile I get and invalid path. I have the txt file located on my server:

WriteAsciiFile("http://xxx.xxx.x.x:port/iploc.txt", myip)

The file does exist and I am capable of clicking on the link and opening the file. When the code runs though I get invalid path. Just need to save the roku's ip some way for future access.
Thanks
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Write IP to tmp

"btpoole" wrote:
Is there a way to write the ip to a txt file which is located on my server? I understand what you are saying about the array and string. I have been able to isolate the value of eth1 but when I attempt to use WriteAsciiFile I get and invalid path. I have the txt file located on my server:

WriteAsciiFile("http://xxx.xxx.x.x:port/iploc.txt", myip)

The file does exist and I am capable of clicking on the link and opening the file. When the code runs though I get invalid path. Just need to save the roku's ip some way for future access.
Thanks


WriteASCIIFile() is for writing to the local filesystem. If you need to send data to a server, you would use roURLTransfer to make a request to an API and the API would then do something useful with it like writing it to a file.
0 Kudos
btpoole
Channel Surfer

Re: Write IP to tmp

Thank you for the info. Will go that way.
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.