on 89b95bd help sign in
81 lines 2.2 kB history raw
1-- |
2-- Module : Streamly.Network.Server
3-- Copyright : (c) 2019 Composewell Technologies
4--
5-- License : BSD3
6-- Maintainer : streamly@composewell.com
7-- Stability : released
8-- Portability : GHC
9--
10-- Combinators to build Inet/TCP clients and servers.
11--
12-- >>> import qualified Streamly.Network.Inet.TCP as TCP
13--
15module Streamly.Network.Inet.TCP
16 (
17 -- * Accept Connections
18 -- ** Unfolds
19 acceptorOnAddr
20 , acceptorOnPort
21 , acceptorOnPortLocal
23 -- * Connect to Servers
24 , connect
26 {-
27 -- XXX Expose this as a pipe when we have pipes.
28 -- * Transformation
29 -- , pipeBytes
31 -- ** Sink Servers
33 -- These abstractions can be applied to any setting where we need to do a
34 -- sink processing of multiple streams e.g. output from multiple processes
35 -- or data coming from multiple files.
37 -- handle connections concurrently using a specified fold
38 -- , handleConnections
40 -- handle frames concurrently using a specified fold
41 , handleFrames
43 -- merge frames from all connection into a single stream. Frames can be
44 -- created by a specified fold.
45 , mergeFrames
47 -- * UDP Servers
48 , datagrams
49 , datagramsOn
50 -}
51 -- * Deprecated
52 , acceptOnAddr
53 , acceptOnPort
54 , acceptOnPortLocal
55 )
56where
58import Control.Monad.IO.Class (MonadIO(..))
59import Data.Word (Word8)
60import Network.Socket (Socket, PortNumber)
61import Streamly.Internal.Data.Unfold.Type (Unfold(..))
63import Streamly.Internal.Network.Inet.TCP
64 hiding (acceptOnAddr, acceptOnPort, acceptOnPortLocal)
66{-# DEPRECATED acceptOnAddr "Please use 'acceptorOnAddr' instead" #-}
67{-# INLINE acceptOnAddr #-}
68acceptOnAddr
69 :: MonadIO m
70 => Unfold m ((Word8, Word8, Word8, Word8), PortNumber) Socket
71acceptOnAddr = acceptorOnAddr
73{-# DEPRECATED acceptOnPort "Please use 'acceptorOnPort' instead" #-}
74{-# INLINE acceptOnPort #-}
75acceptOnPort :: MonadIO m => Unfold m PortNumber Socket
76acceptOnPort = acceptorOnPort
78{-# DEPRECATED acceptOnPortLocal "Please use 'acceptorOnPortLocal' instead" #-}
79{-# INLINE acceptOnPortLocal #-}
80acceptOnPortLocal :: MonadIO m => Unfold m PortNumber Socket
81acceptOnPortLocal = acceptorOnPortLocal