Z-IO-0.1.1.1: Simple and high performance IO toolkit for Haskell
Copyright(c) Dong Han 2018
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.IO.Network.IPC

Description

This module provides an API for creating IPC servers and clients. IPC Support is implemented with named pipes on Windows, and UNIX domain sockets on other operating systems.

On UNIX, the local domain is also known as the UNIX domain. The path is a filesystem path name. It gets truncated to sizeof(sockaddr_un.sun_path) - 1, which varies on different operating system between 91 and 107 bytes. The typical values are 107 on Linux and 103 on macOS. The path is subject to the same naming conventions and permissions checks as would be done on file creation. It will be visible in the filesystem, and will persist until unlinked.

On Windows, the local domain is implemented using a named pipe. The path must refer to an entry in \?pipe or \.pipe. Any characters are permitted, but the latter may do some processing of pipe names, such as resolving .. sequences. Despite appearances, the pipe name space is flat. Pipes will not persist, they are removed when the last reference to them is closed.

Synopsis

IPC Client

data IPCClientConfig Source #

A IPC client configuration

Constructors

IPCClientConfig 

Fields

defaultIPCClientConfig :: IPCClientConfig Source #

Default config, connect to "./ipc".

initIPCClient :: HasCallStack => IPCClientConfig -> Resource UVStream Source #

init a IPC client Resource, which open a new connect when used.

IPC Server

data IPCServerConfig Source #

A IPC server configuration

Constructors

IPCServerConfig 

Fields

defaultIPCServerConfig :: IPCServerConfig Source #

A default hello world server on ./ipc

Test it with main = startIPCServer defaultIPCServerConfig

startIPCServer :: HasCallStack => IPCServerConfig -> IO () Source #

Start a server

Fork new worker thread upon a new connection.