diff options
Diffstat (limited to 'examples/avahi.hs')
-rw-r--r-- | examples/avahi.hs | 16 |
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 | |||
3 | import BasePrelude | ||
4 | import Network.Tox.Avahi | ||
5 | |||
6 | exampleNodeId :: NodeId | ||
7 | exampleNodeId = read $ replicate 43 'a' | ||
8 | |||
9 | main :: IO () | ||
10 | main = 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 | ||