Well, problem is I tried that, but it's not that easy to understand..I mean I know some PHP, but @ python I really suck, they're not very different from one another but still..
Thing is on the BitTorrent Wiki (http://wiki.theory.org/index.php/BitTorrentSpecification#Handshake) they say when the handshake (connection between peers) is something like:
The handshake is a required message and must be the first message transmitted by the client. It is (49+len(pstr)) bytes long.
handshake: <pstrlen><pstr><reserved><info_hash><peer_id>
* pstrlen: string length of <pstr>, as a single raw byte
* pstr: string identifier of the protocol
* reserved: eight ( reserved bytes. All current implementations use all zeroes. Each bit in these bytes can be used to change the behavior of the protocol. An email from Bram suggests that trailing bits should be used first, so that leading bits may be used to change the meaning of trailing bits.
* info_hash: 20-byte SHA1 hash of the info key in the metainfo file. This is the same info_hash that is transmitted in tracker requests.
* peer_id: 20-byte string used as a unique ID for the client. This is usually the same peer_id that is transmitted in tracker requests (but not always e.g. an anonymity option in Azureus).
In version 1.0 of the BitTorrent protocol, pstrlen = 19, and pstr = "BitTorrent protocol".
Thing is I will find the info_hash in a MySQL database and the peer_id will be some fixed value taken from a client, how do I send this and all the rest? How would the syntax look like?