Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2013-10-27 10:14:41 +0400
committerFeross Aboukhadijeh <feross@feross.org>2013-10-27 10:14:41 +0400
commit3232e5ee9b8a771a52f3a484a7f56a82d4340b29 (patch)
treef89f9de6be59938ad46b912062af50c4f69d5316 /index.js
parent53e1a95b34ba52ced71b25b65132eae67b0b2e75 (diff)
receiving DHT responses from the network!
Diffstat (limited to 'index.js')
-rw-r--r--index.js39
1 files changed, 22 insertions, 17 deletions
diff --git a/index.js b/index.js
index 1132b39..0a30fa5 100644
--- a/index.js
+++ b/index.js
@@ -4,27 +4,32 @@
// console.log('This is a Chrome App')
// }
-// var DHT = require('./lib/bittorrent-dht')
-// var leaves = 'D2474E86C95B19B8BCFDB92BC12C9D44667CFA36'
+window.log = function (data) {
+ document.getElementById('console').innerHTML += data + '<br>'
+}
+
+var DHT = require('./lib/bittorrent-dht')
+var leaves = 'D2474E86C95B19B8BCFDB92BC12C9D44667CFA36'
+
+var dht = new DHT(leaves)
+dht.on('peer', function (peer) {
+ console.log(peer)
+})
+dht.findPeers(300)
-// var dht = new DHT(leaves)
-// dht.on('peer', function (peer) {
-// console.log(peer)
-// })
-// dht.findPeers(300)
// Send UDP packet to echo server
-var string = require('./lib/string')
-var socket = require('./socket')
+// var string = require('./lib/string')
+// var socket = require('./socket')
-var sock = new socket.UDPSocket()
-sock.on('bound', function(port) {
- console.log('Bound to port: ' + port)
-})
+// var sock = new socket.UDPSocket()
+// sock.on('bound', function(port) {
+// console.log('Bound to port: ' + port)
+// })
-sock.on('data', function(data, host, port) {
- console.log('Got data from host ' + host + ' port ' + port + ': ' + string.fromUTF8Arr(data))
-})
+// sock.on('data', function(data, host, port) {
+// console.log('Got data from host ' + host + ' port ' + port + ': ' + string.fromUTF8Arr(data))
+// })
-sock.sendTo('lol', 'localhost', 50963)
+// sock.sendTo('lol', 'localhost', 50963)