public
Last active

network-conduit on windows expected "END serverSrc clientSink"

  • Download Gist
netproxy4.hs
Haskell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
{-# OPTIONS -Wall #-}
import Data.Conduit
import Data.Conduit.Network
import Control.Monad.IO.Class (liftIO)
import Control.Concurrent.Lifted (fork)
import Network (withSocketsDo)
 
main::IO ()
main =
liftIO $ withSocketsDo $ runTCPClient (ClientSettings 5000 "127.0.0.1") $ \serverSrc serverSink -> do
liftIO $ withSocketsDo $ runTCPServer (ServerSettings 5002 (Just "127.0.0.1")) $ \clientSrc clientSink -> do
_ <- liftIO $ fork $ do
liftIO $ putStrLn "START serverSrc clientSink"
runResourceT $ do
serverSrc $$ clientSink
liftIO $ putStrLn "END serverSrc clientSink"
liftIO $ putStrLn "START clientSrc serverSink"
clientSrc $$ serverSink
liftIO $ putStrLn "END clientSrc serverSink"
 
 
{-
C:\haskell>netproxy4
START clientSrc serverSink
START serverSrc clientSink
END clientSrc serverSink
START serverSrc clientSink
START clientSrc serverSink
END clientSrc serverSink
-}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.