Forum Discussion

btpoole's avatar
btpoole
Channel Surfer
12 years ago

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

4 Replies

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