rakshasa / rtorrent

rTorrent BitTorrent client
https://github.com/rakshasa/rtorrent/wiki
GNU General Public License v2.0
4.15k stars 412 forks source link

Couldn't set static incoming listen port properly #1279

Open Nirzak opened 4 months ago

Nirzak commented 4 months ago

Hi, I was trying to set a static incoming listen port without a range of ports.

we know that we can set that using the following option

network.port_range.set=port_range

but this config only accepts a range of ports. not a static port. So, I was trying the below config from the website

network.port_open.set
network.port_open

but it seems like they do nothing. we only have a choice now to use the range port config like as the following to use static port

network.port_range.set=static_port-static_port

Am I missing something? or does it still need to be implemented? Thanks a lot.

kannibalox commented 4 months ago

network.port_open is a boolean setting, used for turning on or off the port entirely. network.port_range.set=static_port-static_port is the correct way to set a static port. See https://kannibalox.github.io/rtorrent-docs/cmd-ref.html#network-commands for more details.

Nirzak commented 4 months ago

network.port_open is a boolean setting, used for turning on or off the port entirely. network.port_range.set=static_port-static_port is the correct way to set a static port. See https://kannibalox.github.io/rtorrent-docs/cmd-ref.html#network-commands for more details.

I know and I had exactly used that. used like as the following

network.port_open = yes network.port_open.set = 41200

but nothing happens.

And I know the range trick works but still on the UI it’s showing 41200-41200

I mean why a single static port will be shown like this. with a hyphen in the middle. Isn’t it we can use another config to set the static port in a more correct manner rather than setting it as a range set which is not for static at all? and what is the network.port_open.set config is doing actually then?

kannibalox commented 4 months ago

network.port_open = yes network.port_open.set = 41200

network.port_open is used to query whether or not the value is true, as such it ignores the "yes" and changes nothing. network.port_open.set = 41200 enables the port, since rTorrent considers any non-zero value to be the same as "yes". "yes" is the default, so it still doesn't actually change anything.

I mean why a single static port will be shown like this. with a hyphen in the middle. Isn’t it we can use another config to set the static port in a more correct manner rather than setting it as a range set which is not for static at all? and what is the network.port_open.set config is doing actually then?

It's just a quirk of rtorrent, any kind of new configuration option to set a single port would just be a convenience function that does the exact same thing as network.port_range.set=41200-41200. I'm not sure what you mean when you say it's not static at all. rTorrent will trying to listen on port 41200, and if it's already being listened on, rTorrent will exit with an error message.

Nirzak commented 4 months ago

network.port_open = yes network.port_open.set = 41200

network.port_open is used to query whether or not the value is true, as such it ignores the "yes" and changes nothing. network.port_open.set = 41200 enables the port, since rTorrent considers any non-zero value to be the same as "yes". "yes" is the default, so it still doesn't actually change anything.

I mean why a single static port will be shown like this. with a hyphen in the middle. Isn’t it we can use another config to set the static port in a more correct manner rather than setting it as a range set which is not for static at all? and what is the network.port_open.set config is doing actually then?

It's just a quirk of rtorrent, any kind of new configuration option to set a single port would just be a convenience function that does the exact same thing as network.port_range.set=41200-41200. I'm not sure what you mean when you say it's not static at all. rTorrent will trying to listen on port 41200, and if it's already being listened on, rTorrent will exit with an error message.

Ok I see. Thanks a lot. But I still couldn't grab the purpose of the network.port_open.set configuration option. that what does it do if network.port_range.set is basically setting the incoming port always.

kannibalox commented 4 months ago

If for some reason you wanted to completely disable the listening port, you can't do that via network.port_range.set. You'd need to do network.port_open.set = no.

Nirzak commented 4 months ago

If for some reason you wanted to completely disable the listening port, you can't do that via network.port_range.set. You'd need to do network.port_open.set = no.

Oh OK I see. that means network.port_open and network.port_open.set are the same. the latter is just an alias of the previous one. So it's a boolean value whether we want to turn off the listening port or not. I see. thanks a lot, bro for the explanation.