summaryrefslogtreecommitdiff
path: root/dht/examples/avahi.hs
blob: e5567875e846b6873f98606784941f8472d0f67d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE NoImplicitPrelude #-}

import           BasePrelude
import           Network.Tox.Avahi

exampleNodeId :: NodeId
exampleNodeId = read $ replicate 43 'a'

main :: IO ()
main = do
  [hostname, port, nodeId] <- getArgs
  void $ forkIO $ announceToxServiceWithHostname
    hostname (fromMaybe 54321 $ readMaybe port)
    (fromMaybe exampleNodeId $ readMaybe nodeId) Nothing
  void $ forkIO $ queryToxService (curry print)
  void $ getLine