I"m trying to learn more about bittorrent protocols, and i'm successful in obtaining a list of peers via UDP.
Where I am having trouble with, is making a connection to the peer IPs itself (even before sending a handshake). i'm usually met with errors such as: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I've read up as much as I could, and according to most documentations:
After receiving a peer IP and port-number from the tracker, our client will to open a TCP connection to that peer. Once the connection is open, these peers will start to exchange messages using the peer protocol.
However, I don't think this is as simple as
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port)) # where ip and port is obtained from the list of IPs and PORTS from the tracker
## This above 2 lines of codes is met with a connection attempt failed error.
According to this p2p question on stackoverflow, there is a bunch of low level things that will need to be done in order for me to connect to the list of peers i've obtained from the UDP announce
trackers.
How should I go about in making a connection to the peers?