File: abstract-ns-client.lua

package info (click to toggle)
lua-posix 36.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,720 kB
  • sloc: ansic: 5,462; makefile: 21; sh: 6
file content (14 lines) | stat: -rw-r--r-- 363 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env lua

local M = require 'posix.sys.socket'


local dgram = arg[1] or 'test data'

-- Create an AF_UNIX datagram socket
local s, errmsg = M.socket(M.AF_UNIX, M.SOCK_DGRAM, 0)
assert(s ~= nil, errmsg)

-- Sendto the abtract AF_UNIX name 'mysocket'
local rc, errmsg = M.sendto(s, dgram, {family=M.AF_UNIX, path='\0mysocket'})
assert(rc ~= nil, errmsg)