From f7245e3cc7c5729b401bbbe3438a9f5b9dda211b Mon Sep 17 00:00:00 2001 From: Sam T Date: Mon, 8 Jul 2013 04:52:10 +0400 Subject: ~ Unliterate example. --- examples/Main.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/Main.hs (limited to 'examples/Main.hs') diff --git a/examples/Main.hs b/examples/Main.hs new file mode 100644 index 00000000..bc3fbb8b --- /dev/null +++ b/examples/Main.hs @@ -0,0 +1,23 @@ +module Main (main) where + +import Control.Monad +import Network.BitTorrent +import Network.BitTorrent.Extension +import System.Environment +import Control.Monad.Trans + +main :: IO () +main = do + [path] <- getArgs + torrent <- fromFile path + print (contentLayout "./" (tInfo torrent)) + client <- newClient 100 [ExtDHT] + swarm <- newLeecher client torrent + storage <- swarm `bindTo` "/tmp/" + ppStorage storage >>= print + discover swarm $ do + liftIO $ print "connected to peer" + forever $ do + liftIO (getCurrentProgress client >>= print) + exchange storage + liftIO $ print "disconnected" -- cgit v1.2.3