Check Seeds/Peers on a UDP tracker
Posted: Thu Oct 13, 2011 6:44 pm
I am trying to find the seeds/peers from a UDP tracker but I have not been successful in doing it.
Protocol description -> http://bittorrent.org/beps/bep_0015.htm ... r-protocol
The both integers printed should be same but when I run this, they aren't.
Corresponding stackoverflow which was un-answered. -> http://stackoverflow.com/questions/7758 ... -in-python
Protocol description -> http://bittorrent.org/beps/bep_0015.htm ... r-protocol
Code: Select all
import struct
import socket
import random
clisocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
packet = "\x00\x00\x04\x17\x27\x10\x19\x80"
transaction_id = random.randrange(1,65535)
print transaction_id
packet = packet+struct.pack(">i", 0)
packet = packet+struct.pack(">i", transaction_id)
clisocket.sendto(packet, ("tracker.istole.it", 80))
res = clisocket.recv(16)
print struct.unpack(">i", res[12:16])
Corresponding stackoverflow which was un-answered. -> http://stackoverflow.com/questions/7758 ... -in-python