I first thought of learning some more Lua to make the script socket-aware. But then it hit me: Linux has all this built in, into a "super server" called inetd, which i've never actually used before but kinda know of due to its history of security issues. Still, i feel like such a late bloomer for never having used inetd before.
Here's how, if you're one of the inetd virgins. Edit /etc/services and add the name, port and protocol of my service. In my case, i called it relay 11647/tcp. Call update-inetd --add ...and a bunch of arguments separated by the t character, as one wonky string. Yeah, it's hairy.
I needed to make just one change to the Lua script. Since the script won't read command line arguments anymore -- and i don't know if it's by design or my deficiency -- i had to add if rel == Nil then rel, act = io.read( "*number", "*number" ) end into the code.
Still, now i can say echo 4 1 | nc gardengnome 11647 which is a sure sign about a turn for the better :)
Did this make any sense at all to you?