Skip to content

fs socket

TurtleKitty edited this page May 11, 2019 · 2 revisions

FS socket

NOTE: Unix domain sockets are broken at the moment; the egg I was using hasn't been updated to Chicken Scheme 5

An fs-socket is a unix domain socket living on the local filesystem. It is bidirectional, so supports the methods of both sink and source streams.

Sockets come from three places: sys.fs.connect, the accept method of an fs-listener created by sys.fs.listen, or a call to sys.fs.socket-pair.

listener messages

(def server (sys.fs.listen "/tmp/foo_server"))

server.type    ; 'fs-listener
server.path    ; "/tmp/foo_server"
server.accept  ; returns (fs socket source sink stream)
server.close   ; this kills the listener

socket messages

(def client (sys.fs.connect "/tmp/foo_server"))

client.type    ; (fs socket source sink stream)
client.path    ; "/tmp/foo_server"
client.close   ; this kills the socket
Clone this wiki locally