Skip to content

@thelff /netproxy4.hs

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
network-conduit on windows expected "END serverSrc clientSink"
{-# 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 "") $ \serverSrc serverSink -> do
liftIO $ withSocketsDo $ runTCPServer (ServerSettings 5002 (Just "")) $ \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"
START clientSrc serverSink
START serverSrc clientSink
END clientSrc serverSink
START serverSrc clientSink
START clientSrc serverSink
END clientSrc serverSink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.