Copyright | (c) Dong Han 2018 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
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
- data IPCClientConfig = IPCClientConfig {
- ipcClientName :: Maybe CBytes
- ipcTargetName :: CBytes
- defaultIPCClientConfig :: IPCClientConfig
- initIPCClient :: HasCallStack => IPCClientConfig -> Resource UVStream
- data IPCServerConfig = IPCServerConfig {
- ipcListenName :: CBytes
- ipcListenBacklog :: Int
- ipcServerWorker :: UVStream -> IO ()
- defaultIPCServerConfig :: IPCServerConfig
- startIPCServer :: HasCallStack => IPCServerConfig -> IO ()
IPC Client
data IPCClientConfig Source #
A IPC client configuration
IPCClientConfig | |
|
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
IPCServerConfig | |
|
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.