Forum Discussion

stuthemonkey's avatar
14 years ago

Roku control via netcat

I'm in the process of setting up a bunch of roku's and I want to write a batch file for windows that will automatically make a stack of roku's run a specific channel.

From a mac I can run this command: echo -e 'POST /launch/dev HTTP/1.1\r\n\r\n' | nc 192.168.0.71 8060 and it works perfectly to startup the channel with an ID of dev.

However I have been unable to use netcat for windows to do the same thing. I know the format of the command will need to be a little different for windows. However I have not been able to figure out what i'm doing wrong. Can someone translate that command to one that will run in windows?

Here is the version of netcat for windows I'm using. http://joncraton.org/blog/46/netcat-for-windows

From everything I have tried half the time I get netcat to crash. Other times I get no output, but nothing I try actually makes the roku do anything. So I know all my attempts to make the command work in windows is just malformed.

Thanks for any help anyone can provide.

2 Replies

  • renojim's avatar
    renojim
    Community Streaming Expert
    The problem is trying to get those CR/LFs into an echo command. I tried a few things without much luck. The easiest thing to do is to put the POST into a text file and then redirect it into netcat. The text file would look like:
    POST /launch/dev HTTP/1.1

    Note that there is a blank line after the POST line. Then you redirect that file (I called it launch.txt) into netcat:
    nc 192.168.0.71 8060 < launch.txt

    If you work from the command line in Windows a lot you may want to do yourself a favor and look into Take Command. The free light version, TCC/LE, is probably all you'd ever need and is a vast improvement over cmd.exe.

    With TCC/LE the command would look like:
    echo POST /launch/dev HTTP/1.1%=r%=n | nc 192.168.0.71 8060

    Hope this helps!
    -JT
  • Thanks for the tip on Take Command. I've been looking for something like this!