summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2020-01-03 01:33:22 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-03 01:33:45 -0500
commit3fdd5ee1ede2e4776dc49269793d245e3ef8580a (patch)
tree88e1c3bbf4f155f5c7c08518270df6d7cfb2a84a /examples
parent9e57739768cf456a8d3e85c43321d5997cf19ed5 (diff)
Fixed history-edit error: tcpclient.hs belongs under dht/
Diffstat (limited to 'examples')
-rw-r--r--examples/tcpclient.hs49
1 files changed, 0 insertions, 49 deletions
diff --git a/examples/tcpclient.hs b/examples/tcpclient.hs
deleted file mode 100644
index d168b1fb..00000000
--- a/examples/tcpclient.hs
+++ /dev/null
@@ -1,49 +0,0 @@
1import Control.Monad
2import Control.Concurrent
3import Control.Concurrent.STM
4import System.Environment
5
6import Crypto.Tox
7import Network.Tox.TCP
8import Network.QueryResponse
9import DebugTag
10import DPut
11
12main :: IO ()
13main = do
14 setVerbose XMisc
15 setVerbose XTCP
16 setVerbose XUnexpected
17 crypto <- newCrypto
18 (_,client) <- newClient crypto id (\cb p -> cb (Just (False,p)))
19 quitTCP <- forkListener "TCP-recv" (addHandler print (handleMessage client) $ clientNet client)
20 args <- getArgs
21 let addr = read $ args !! 0
22
23 putStrLn $ unlines
24 [ "-------------------------------"
25 , "PING TEST"
26 , "-------------------------------"
27 , "ping " ++ show addr
28 ]
29 r <- tcpPing client (addr :: NodeInfo)
30 print r
31
32 forM_ (drop 1 args) $ (. read) $ \gw -> do
33 putStrLn $ unlines
34 [ "-------------------------------"
35 , "GetNodes TEST"
36 , "-------------------------------"
37 ]
38 -- getUDPNodes :: TCPClient err () Nonce8 -> NodeId -> UDP.NodeInfo -> IO (Maybe ([UDP.NodeInfo], [UDP.NodeInfo], Maybe ()))
39 let nid = read "OrjBG.GyWuQhGc1pb0KssgmYAocohFh35Vx8mREC9Nu"
40 s <- getUDPNodes (TCPClient crypto client $ \_ -> return $ Just gw) nid (udpNodeInfo addr)
41 print s
42
43 putStrLn $ unlines
44 [ "-------------------------------"
45 , "quitTCP"
46 , "-------------------------------"
47 ]
48 quitTCP
49 return ()