Ticket #140 (closed enhancement: fixed)
allow unix domain sockets in nixio sendto and recvfrom
|Reported by:||reporter||Owned by:|
|Component:||LuCI Base||Keywords:||unix socket recvfrom|
Please find a patch in attachment that implements the AF_UNIX domain socket in the socket:sendto and socket:recvfrom functions. Especially the recvfrom is important when using the connectionless DGRAM sockets. For the server to be able to reply to an incoming request on a DGRAM socket, it needs to determine where the packet originated, in which case the recv or read methods will not do.
- Even with an unpatched io file, I did not manage to get the sendto to work properly with AF_INET domain sockets:
> print(s:sendto('test', '127.0.0.1', 8080)) nil 22 Invalid argument
- Linux itself apparently does not like the sendto to be used in conjunction with unix domain sockets (without being preceded by a connect, but then the sendto itself is quite useless):
> print(s:sendto('test', '/var/run/flukso/client.sock', 0)) nil 134 Transport endpoint is not connected
While this is clearly possible in HP-UX, see: http://docs.hp.com/en/B2355-90136/ch07s06.html.
Bart Van Der Meerssche.