6.96. kink/socket/UNIX_DOMAIN_SOCKET_PATH¶
6.96.1. type unix_domain_socket_path¶
`unix_domain_socket_path` is a path of a UNIX domain socket.
`unix_domain_socket_path` is a subtype of `socket_address`.
Example
:UNIX_DOMAIN_SOCKET_PATH.require_from('kink/socket/')
:PROTOCOL_FAMILY.require_from('kink/socket/')
:TCP.require_from('kink/socket/')
:TCP_SERVER.require_from('kink/socket/')
:BIN.require_from('kink/')
:CONTROL.require_from('kink/')
:Udsp <- UNIX_DOMAIN_SOCKET_PATH.new('foo.uds')
:spawn_client <- {
CONTROL.with_finally{(:finally)
:Tcp = TCP.open(PROTOCOL_FAMILY.unix)
finally{ Tcp.close }
Tcp.connect(Udsp)
:Out = Tcp.output
finally{ Out.close }
Out.write(BIN.of(1 2 3))
}
}
CONTROL.with_finally{(:finally)
:Serv = TCP_SERVER.open(PROTOCOL_FAMILY.unix)
finally{ Serv.close }
Serv.bind_listen(Udsp)
spawn_client
:Tcp = Serv.accept
finally{ Tcp.close }
:In = Tcp.input
finally{ In.close }
:Bin = In.read_all
stdout.print_line(Bin.repr) # => (bin 0x01 0x02 0x03)
}
6.96.1.1. Udsp.path¶
`path` returns the path on the file system of the UNIX domain socket as a `str` value.
6.96.1.2. Udsp.protocol_family¶
`protocol_family` returns PROTOCOL_FAMILY.unix.
6.96.1.3. Udsp == Addr¶
`==` operator, or `op_eq` method, returns true if and only if `Addr` is a `unix_domain_socket_path` value, and the paths of `Udsp` and `Addr` are equal by `==` operator of type `str`.
Precondition
`Addr` must be a `socket_address`.
6.96.2. UNIX_DOMAIN_SOCKET_PATH.new(Path)¶
`new` returns a `unix_domain_socket_path` value.
Precondition
`Path` must be a `str`.
6.96.3. UNIX_DOMAIN_SOCKET_PATH.is?(Val)¶
`is?` returns whether `Val` is a `unix_domain_socket_path` value.