diff options
Diffstat (limited to 'exsamples/Main.hs')
-rw-r--r-- | exsamples/Main.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/exsamples/Main.hs b/exsamples/Main.hs new file mode 100644 index 00000000..3a347ab6 --- /dev/null +++ b/exsamples/Main.hs | |||
@@ -0,0 +1,20 @@ | |||
1 | module Main (main) where | ||
2 | |||
3 | import Data.Bitfield | ||
4 | import Network.BitTorrent | ||
5 | import System.Environment | ||
6 | |||
7 | |||
8 | main :: IO () | ||
9 | main = do | ||
10 | [path] <- getArgs | ||
11 | Right torrent <- fromFile path | ||
12 | |||
13 | client <- newClient [] | ||
14 | swarm <- newLeacher client torrent | ||
15 | |||
16 | discover swarm $ \se -> do | ||
17 | peers <- getPeerList se | ||
18 | print peers | ||
19 | |||
20 | print "Bye-bye!" \ No newline at end of file | ||