summaryrefslogtreecommitdiff
path: root/examples/avahi.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/avahi.hs')
-rw-r--r--examples/avahi.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/avahi.hs b/examples/avahi.hs
new file mode 100644
index 00000000..e5567875
--- /dev/null
+++ b/examples/avahi.hs
@@ -0,0 +1,16 @@
1{-# LANGUAGE NoImplicitPrelude #-}
2
3import BasePrelude
4import Network.Tox.Avahi
5
6exampleNodeId :: NodeId
7exampleNodeId = read $ replicate 43 'a'
8
9main :: IO ()
10main = do
11 [hostname, port, nodeId] <- getArgs
12 void $ forkIO $ announceToxServiceWithHostname
13 hostname (fromMaybe 54321 $ readMaybe port)
14 (fromMaybe exampleNodeId $ readMaybe nodeId) Nothing
15 void $ forkIO $ queryToxService (curry print)
16 void $ getLine