diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2013-10-27 10:14:41 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2013-10-27 10:14:41 +0400 |
commit | 3232e5ee9b8a771a52f3a484a7f56a82d4340b29 (patch) | |
tree | f89f9de6be59938ad46b912062af50c4f69d5316 /index.js | |
parent | 53e1a95b34ba52ced71b25b65132eae67b0b2e75 (diff) |
receiving DHT responses from the network!
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 39 |
1 files changed, 22 insertions, 17 deletions
@@ -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) |