Why bittorrent needs as many ports?..Why not just one-2? I know that some of them are used for peer discovery, but dont exactly know how is this happening. Can you please provide more technical information about how bittorent works(deeper than its described in wikipedia)?
closed as off topic by Joel Coel, Ward, sam, Iain, Scott Pack Nov 8 '11 at 13:29
Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.
Here is the specification incase you were curious, http://wiki.theory.org/BitTorrentSpecification
BitTorrent needs many ports because it makes many outbound connections. Typical operating systems (including Windows, Linux, and most others) only permit a single outbound connection per local port per IP address. All of your inbound connections will use the same local port. But each outbound connection will be assigned a random local port by the operating system.
Your outbound connections will have the remote port that the other client is listening on. Your inbound connections will have essentially random remote ports, since they are allocated by the remote operating system effectively randomly.
Typically, a TCP connection only has a well-known port on the receiving side. BitTorrent is not an exception to the usual rule. Most likely it only seems unusual to you because you're not used to having a large number of inbound connections. Also, some people specifically change their BitTorrent server port, and you have to connect to them on whatever port they happen to be using, whether it's the well-known normal port (6881) or not.