Closed FLYBYME closed 8 years ago
This is the code im running.
//192.168.1.101:9879
var dhtPort = 20001
var serverPort = 9879
var Protocol = require('bittorrent-protocol')
var net = require('net')
net.createServer(function(socket) {
var wire = new Protocol()
// pipe to and from the protocol
socket.pipe(wire).pipe(socket)
wire.on('handshake', function(infoHash, peerId) {
console.log('handshake')
})
wire.on('unchoke', function() {
console.log('peer is no longer choking us: ' + wire.peerChoking)
})
}).listen(serverPort);
The client im using is utorrent 2.2
More error:
bittorrent-protocol [7cfa097b] new wire +0ms
bittorrent-protocol [7cfa097b] Error: wire not speaking BitTorrent protocol (?!??♂??→?↨ ????§????m▬.¶??E;↨?&?♠? "?_♫z??R????DU?]???h???♣►☼?♠??
.?}??$?@?Zv?8???V???_??IJ???§↑?5?u'?-{↑???y??.B????`??♣?e???kF2???l???k?c??k??L[?- A?1>??;6??2?[♂5?
?e??SC?5?∟?☺??n?
B?Fb????) +204ms
bittorrent-protocol [7cfa097b] end +4ms
bittorrent-protocol [7cfa097b] got uninterested +0ms
bittorrent-protocol [7cfa097b] got choke +1ms
bittorrent-protocol [e8e24ae6] new wire +48s
&It?↔F↓??B?|??I?↔?♂?n#U?R)?u?↨?F|? ) +2mse not speaking BitTorrent protocol (?????
bittorrent-protocol [e8e24ae6] end +1ms
bittorrent-protocol [e8e24ae6] got uninterested +0ms
bittorrent-protocol [e8e24ae6] got choke +1ms
``
When you get the 'handshake'
event, you need to immediately respond with a wire.handshake()
back.
wire.on('handshake', function(infoHash, peerId) {
wire.handshake(infoHash, myPeerId)
})
Im playing around with the code but keep getting this error when i tell utorrent to connect.