Ryan Culpepper <ryanc@racket-lang.org>
This library provides support for unix domain sockets (specifically, sockets with family AF_UNIX and type SOCK_STREAM).
value
procedure
socket-path:unix-socket-path?
procedure
v:any/c
If v is a path (path-string? ), the length of v’s corresponding absolute path must be less than or equal to the platform-specific length (108 bytes on Linux, 104 bytes on BSD and Mac OS X). Example: "/tmp/mysocket".
If v is a bytestring (bytes? ), it represents an abstract socket name, supported only on Linux. The first byte of v must be NUL, and its length must be less than or equal to 108 bytes. Such a value refers to a socket in the Linux abstract socket namespace. Example: #"0εmysocket".
Note that NUL bytes are allowed in abstract socket names. For example, #"0εabc" and #"0εabc0ε" are both valid—and different—abstract socket names.
Otherwise, returns #f.
procedure
( unix-socket-listen socket-path[backlog])→unix-socket-listener?
socket-path:unix-socket-path?
If socket-path refers to a filesystem path, binding the socket creates a file that must be deleted separately from closing the listener.
procedure
v:any/c
A unix socket listener acts as a synchronizable event. It is ready when a client connection is ready to be accepted (see unix-socket-accept ), and its synchronization result is the listener itself.
procedure
( unix-socket-close-listener listener)→void?
listener:unix-socket-listener?
procedure
listener:unix-socket-listener?
procedure
( unix-socket-accept-evt listener)→evt?
listener:unix-socket-listener?
Added in version 1.2 of package unix-socket-lib.
This module provides an implementation of the tcp^ signature that can be used to make the Web Server listen on a unix domain socket.
procedure
( make-unix-socket-tcp@ socket-path)→unit?
socket-path:unix-socket-path?
For example, the following code would instruct the web server to listen for connections via a unix socket at "/var/server.sock":
#:dispatcha-dispatcher)
Added in version 1.3 of package unix-socket-lib.