1-- A concurrent TCP server that:
3-- * receives connections from clients
4-- * splits the incoming data into lines
5-- * lines from concurrent connections are merged into a single srteam
6-- * writes the line stream to an output file
8import System.Environment (getArgs)
12import qualified Streamly.FileSystem.Handle as FH
13import qualified Streamly.Fold as FL
14import qualified Streamly.Mem.Array as A
15import qualified Streamly.Network.Socket as NS
16import qualified Streamly.Network.Server as NS
17import qualified Streamly.Prelude as S
19import System.IO (withFile, IOMode(..))
23 file <- fmap head getArgs
24 withFile file AppendMode
26 $ encodeChar8Unchecked
28 $ S.concatMapBy parallel (flip NS.withSocketS recv)
29 $ NS.connectionsOnAllAddrs 8090)
34 FL.splitSuffixBy' (== '\n') A.toArray
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list