unixdgramsrvr.lua 237 B

123456789
  1. socket = require"socket"
  2. socket.unix = require"socket.unix"
  3. u = assert(socket.unix.dgram())
  4. assert(u:bind("/tmp/foo"))
  5. while 1 do
  6. x, r = assert(u:receivefrom())
  7. print(x, r)
  8. assert(u:sendto(">" .. x, r))
  9. end