luaposix 35.1 Reference

## packet-socket.lua

    #! /usr/bin/env lua

    local M = require 'posix.sys.socket'

    -- Packet socket loopback test
    -- Need CAP_NET_RAW, otherwise get "Operation not permitted"
    if M.AF_PACKET ~= nil then
        local fd = assert(M.socket(M.AF_PACKET, M.SOCK_RAW, 0))
        assert(M.bind(fd, {family=M.AF_PACKET, ifindex=M.if_nametoindex("lo")}))
        assert(M.send(fd, string.rep("1", 64)) == 64)
        require 'posix.unistd'.close(fd)
    end

generated by LDoc 1.4.6 Last updated 2021-09-09 17:41:28