[Libtorrent-devel] Port range vs. just one port

Michael Alger libtorrent at mm.quex.org
Mon Mar 12 12:41:02 UTC 2007


On Mon, Mar 12, 2007 at 02:35:41PM +0300, Evgeniy Karyakin wrote:
> 2007/3/7, markus reichelt <ml at mareichelt.de>:
>> Ezequiel Birman <ezebirman at yahoo.com.ar> wrote:
>>> I have set 'port_range = 55557-55557' in .rtorrent.rc
>>>
>>> 1) It's ok to use just one port or should I open more?
>> 
>> It's ok, I'm also using only one port.
>
> That way you won't let incoming connections to be made. You'll be
> able to download files and upload it back to peers that *you* have
> connected to, but others won't be able to connect to you. It's a
> little bit unfair.
> Or am I getting it wrong?

The example above will cause rtorrent to use a single listening port
for all torrents (55557). This doesn't cause problems because each
torrent is identified by its magic hash value, which tends to be
pretty unique.  I'm not sure why the official client uses a
different port for each torrent; possibly it's a debugging aide.

A larger port range increases the chances that rtorrent will find an
unbound port it can use. This can be useful if you have several
programs using the same port range for inbound connections.

A less likely benefit to using a larger port range is that it can
randomise the ports you use for torrent traffic, which might be
helpful if you want to avoid traffic analysis (on the other hand if
everyone you connect to uses the standard port that won't help you
much). It might also help performance if you have very large numbers
of connections, but I'm not sure about that one.


More information about the Libtorrent-devel mailing list