Handbook
Glossary
make-sockaddr ( addrspec -- sockaddr )
Vocabulary
io
.
sockets
.
private
Inputs
addrspec
an
object
Outputs
sockaddr
an
object
Definition
IN:
io.sockets.private
GENERIC:
make-sockaddr
( addrspec -- sockaddr )
Methods
USING:
accessors
alien.c-types
alien.data
io.sockets
io.sockets.private
kernel
;
M:
ipv4
make-sockaddr
[
make-sockaddr-part
]
[
host>>
"0.0.0.0"
or
]
[
inet-pton
uint
deref
>>addr
]
tri
;
USING:
accessors
io.sockets
io.sockets.private
kernel
;
M:
ipv6
make-sockaddr
[
make-sockaddr-in6-part
]
[
[
host>>
"::"
or
]
keep
inet-pton
>>addr
]
[
scope-id>>
>>scopeid
]
tri
;
USING:
accessors
alien.strings
io.encodings.utf8
io.pathnames
io.sockets
io.sockets.private
kernel
math
sequences
unix.ffi
;
M:
local
make-sockaddr
path>>
absolute-path
dup
length
1
+
max-un-path
>
[
"Path too long"
throw
]
when
sockaddr-un
new
AF_UNIX
>>family
swap
utf8
string>alien
>>path
;