diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Client.hs | 17 | ||||
-rw-r--r-- | examples/Main.hs | 18 |
2 files changed, 17 insertions, 18 deletions
diff --git a/examples/Client.hs b/examples/Client.hs new file mode 100644 index 00000000..efafba72 --- /dev/null +++ b/examples/Client.hs | |||
@@ -0,0 +1,17 @@ | |||
1 | module Main (main) where | ||
2 | |||
3 | import Control.Concurrent | ||
4 | import Data.Default | ||
5 | import Data.Torrent | ||
6 | import Network.BitTorrent.Client | ||
7 | import System.Environment | ||
8 | import Text.PrettyPrint.Class | ||
9 | |||
10 | |||
11 | main :: IO () | ||
12 | main = do | ||
13 | [path] <- getArgs | ||
14 | torrent <- fromFile path | ||
15 | client <- newClient def | ||
16 | addTorrent torrent client | ||
17 | return () \ No newline at end of file | ||
diff --git a/examples/Main.hs b/examples/Main.hs deleted file mode 100644 index ef12cc70..00000000 --- a/examples/Main.hs +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | module Main (main) where | ||
2 | |||
3 | import Control.Concurrent | ||
4 | import Network.BitTorrent | ||
5 | import Network.BitTorrent.Sessions | ||
6 | import System.Environment | ||
7 | |||
8 | main :: IO () | ||
9 | main = do | ||
10 | [path] <- getArgs | ||
11 | torrent <- fromFile path | ||
12 | print (contentLayout "./" (tInfo torrent)) | ||
13 | let loc = TorrentLoc path "/tmp" | ||
14 | |||
15 | withDefaultClient (head defaultPorts) 3000 $ \ client -> do | ||
16 | openSwarmSession client loc | ||
17 | threadDelay 1000000000000 | ||
18 | return () | ||