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)
11import Streamly.Data.String
12import qualified Streamly.FileSystem.Handle as FH
13import qualified Streamly.Memory.Array as A
14import qualified Streamly.Network.Socket as NS
15import qualified Streamly.Network.Server as NS
16import qualified Streamly.Prelude as S
18import System.IO (withFile, IOMode(..))
22 file <- fmap head getArgs
23 withFile file AppendMode
24 (\src -> S.runFold (FH.write src)
25 $ encodeChar8Unchecked
27 $ S.concatMapWith parallel (flip NS.withSocketS recv)
28 $ NS.connectionsOnAllAddrs 8090)
33 S.splitWithSuffix (== '\n') A.write
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