added unlinking section to posix socket binding documentation
This commit is contained in:
1 parent
826abd6245
commit
943b09a8b1
1 file changed
+6
@@ -48,6 +48,12 @@ foreign libc {
|
|||||||
addr.sun_family = .UNIX
|
addr.sun_family = .UNIX
|
||||||
copy(addr.sun_path[:], "/somepath\x00")
|
copy(addr.sun_path[:], "/somepath\x00")
|
||||||
|
|
||||||
|
/*
|
||||||
|
unlink the socket before binding in case
|
||||||
|
of previous runs not cleaning up the socket
|
||||||
|
*/
|
||||||
|
posix.unlink("/somepath")
|
||||||
|
|
||||||
if posix.bind(sfd, (^posix.sockaddr)(&addr), size_of(addr)) != .OK {
|
if posix.bind(sfd, (^posix.sockaddr)(&addr), size_of(addr)) != .OK {
|
||||||
/* Handle error */
|
/* Handle error */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user