i am realy struggling to connect and read from a existing unix file socket.
the socket exist, is Mode +rwx and should return a json oneliner (without newline).
(i have no Problem to read the socket on debian based systems like ncat -U /run/fastd.supernode.sock
)
While i try to solve it on a embedded device TP-Link841v11-ND Mips (Fastd Socket on an OpenWRT / LEDE Router from TP Link) mainly only lua (and luasocket) is available. i come so far
$ lua
> socket = require"socket"
> socket.unix = require"socket.unix"
> getme = socket.unix("/var/run/fastd.mesh_vpn.socket")
> print(getme:receive())
stdin:1: calling 'receive' on bad self (unix{client} expected, got userdata)
stack traceback:
[C]: in function 'receive'
stdin:1: in main chunk
[C]: ?
solution, for those who have similar problems
(as described here https://forum.freifunk.net/t/connect-fastd-socket-on-tp841v11-fastd-statistiken/13499 )
(you need to reconnect each time you wanna read socket)
$ lua
> require "socket"
> require "socket.unix"
> c = socket.unix()
> c:connect("/var/run/fastd.mesh_vpn.socket")
> print(c:receive())