A Unix domain socket extension for the https://github.com/lpeterse/haskell-socket library
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
platform
platform_test
src/System/Socket/Family
test
.gitignore
.travis.yml
LICENSE
README.md
Setup.hs
socket-unix.cabal
stack-ghc7.10.3.yaml
stack-ghc8.0.2.yaml
stack.yaml

README.md

Available on Hackage License MIT Build Status

socket-unix

A Unix domain socket API for the socket library.

Usage

Creating the Unix domain socket:

import System.Socket
import System.Socket.Type.Stream
import System.Socket.Family.Unix

s <- socket :: IO (Socket Unix Stream Unix)

Creating the address for binding/connecting

address <- case socketAddressUnixPath "example.sock" of
             Just addr -> pure addr
             Nothing -> putStrLn "invalid pathname for socket"

Symlinks

Binding to a socket with a filename creates a socket in the filesystem, but does not unlink it after close called. You should handle deleting links yourself.

Portability

Linux and OS X are supported.