conduit-extra-1.1.9.2: Batteries included conduit: adapters for common libraries.

Safe Haskell | None
Language | Haskell98

Data.Conduit.Network.Unix

Contents

- Basic utilities
- Simple server/client interface
  - Server
  - Client
  - Getters
  - Setters

Synopsis

- sourceSocket :: MonadIO m => Socket -> Producer m ByteString
- sinkSocket :: MonadIO m => Socket -> Consumer ByteString m ()
- data AppDataUnix :: *
- appSource :: (HasReadWrite ad, MonadIO m) => ad -> Producer m ByteString
- appSink :: (HasReadWrite ad, MonadIO m) => ad -> Consumer ByteString m ()
- data ServerSettingsUnix :: *
- serverSettings :: FilePath -> ServerSettingsUnix
- runUnixServer :: ServerSettingsUnix -> (AppDataUnix -> IO ()) -> IO a
- data ClientSettingsUnix :: *
- clientSettings :: FilePath -> ClientSettingsUnix
- runUnixClient :: ClientSettingsUnix -> (AppDataUnix -> IO a) -> IO a
- getPath :: HasPath a => a -> FilePath
- getAfterBind :: HasAfterBind a => a -> Socket -> IO ()
- setPath :: HasPath a => FilePath -> a -> a
- setAfterBind :: HasAfterBind a => (Socket -> IO ()) -> a -> a

# Basic utilities

sourceSocket :: MonadIO m => Socket -> Producer m ByteString Source

Stream data from the socket.

This function does not automatically close the socket.

Since 0.0.0

sinkSocket :: MonadIO m => Socket -> Consumer ByteString m () Source

Stream data to the socket.

This function does not automatically close the socket.

Since 0.0.0

# Simple server/client interface

data AppDataUnix :: *

The data passed to a Unix domain sockets `Application`.

Instances

HasReadWrite AppDataUnix |

appSource :: (HasReadWrite ad, MonadIO m) => ad -> Producer m ByteString Source

appSink :: (HasReadWrite ad, MonadIO m) => ad -> Consumer ByteString m () Source

## Server

data ServerSettingsUnix :: *

Settings for a Unix domain sockets server.

Instances

HasPath ServerSettingsUnix |
HasAfterBind ServerSettingsUnix |
HasReadBufferSize ServerSettingsUnix | Since 0.1.13

serverSettings :: FilePath -> ServerSettingsUnix Source

runUnixServer :: ServerSettingsUnix -> (AppDataUnix -> IO ()) -> IO a

Run an `Application` with the given settings. This function will create a new listening socket, accept connections on it, and spawn a new thread for each connection.

## Client

data ClientSettingsUnix :: *

Settings for a Unix domain sockets client.

Instances

HasPath ClientSettingsUnix |
HasReadBufferSize ClientSettingsUnix | Since 0.1.14

clientSettings :: FilePath -> ClientSettingsUnix Source

runUnixClient :: ClientSettingsUnix -> (AppDataUnix -> IO a) -> IO a

Run an `Application` by connecting to the specified server.

## Getters

getPath :: HasPath a => a -> FilePath

getAfterBind :: HasAfterBind a => a -> Socket -> IO ()

## Setters

setPath :: HasPath a => FilePath -> a -> a

setAfterBind :: HasAfterBind a => (Socket -> IO ()) -> a -> a