Safe Haskell | None |
---|---|
Language | GHC2021 |
Box.TCP
Description
TCP Boxes.
Synopsis
- data TCPConfig = TCPConfig {
- hostPreference :: HostPreference
- host :: Text
- port :: Text
- chunk :: Int
- endLine :: Text
- defaultTCPConfig :: TCPConfig
- data TCPEnv = TCPEnv {}
- data Socket
- connect :: TCPConfig -> Codensity IO TCPEnv
- serve :: TCPConfig -> Codensity IO TCPEnv
- receiver :: TCPConfig -> Committer IO ByteString -> Socket -> IO ()
- sender :: Emitter IO ByteString -> Socket -> IO SocketStatus
- duplex :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> Socket -> IO ()
- clientBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO ()
- clientCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString
- serverBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO ()
- serverCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString
- responseServer :: TCPConfig -> (ByteString -> Maybe ByteString) -> IO ()
Documentation
TCP configuration
>>>
defaultTCPConfig
TCPConfig {hostPreference = HostAny, host = "127.0.0.1", port = "3566", chunk = 2048, endLine = "\n"}
Constructors
TCPConfig | |
Fields
|
Instances
defaultTCPConfig :: TCPConfig Source #
default
An active TCP environment
Basic type for a socket.
receiver :: TCPConfig -> Committer IO ByteString -> Socket -> IO () Source #
Commit received ByteStrings.
sender :: Emitter IO ByteString -> Socket -> IO SocketStatus Source #
Send emitted ByteStrings.
duplex :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> Socket -> IO () Source #
A two-way connection.
clientBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO () Source #
A Box
action for a client.
clientCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString Source #
A client CoBox
.
serverBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO () Source #
A Box
action for a server.
serverCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString Source #
A server CoBox
.
responseServer :: TCPConfig -> (ByteString -> Maybe ByteString) -> IO () Source #
A receiver that applies a response function to received ByteStrings.