box-socket-0.5.1.0: Box websockets
Safe HaskellSafe-Inferred
LanguageGHC2021

Box.TCP

Description

TCP Boxes.

Synopsis

Documentation

data TCPConfig Source #

TCP configuration

>>> defaultTCPConfig
TCPConfig {hostPreference = HostAny, host = "127.0.0.1", port = "3566", chunk = 2048, endLine = "\n"}

Constructors

TCPConfig 

Instances

Instances details
Generic TCPConfig Source # 
Instance details

Defined in Box.TCP

Associated Types

type Rep TCPConfig :: Type -> Type #

Show TCPConfig Source # 
Instance details

Defined in Box.TCP

Eq TCPConfig Source # 
Instance details

Defined in Box.TCP

type Rep TCPConfig Source # 
Instance details

Defined in Box.TCP

data TCPEnv Source #

An active TCP environment

Constructors

TCPEnv 

data Socket #

Basic type for a socket.

Instances

Instances details
Show Socket 
Instance details

Defined in Network.Socket.Types

Eq Socket 
Instance details

Defined in Network.Socket.Types

Methods

(==) :: Socket -> Socket -> Bool #

(/=) :: Socket -> Socket -> Bool #

connect :: TCPConfig -> Codensity IO TCPEnv Source #

connect an action (ie a client)

serve :: TCPConfig -> Codensity IO TCPEnv Source #

serve an action (ie a server)

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.

serverBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO () Source #

A Box action for a server.

responseServer :: TCPConfig -> (ByteString -> Maybe ByteString) -> IO () Source #

A receiver that applies a response function to received ByteStrings.