In my plugin I'm using settings.getInt(["server", "port"]) to obtain the server port. However, I found out that when OctoPrint is launched with octoprint --port=5001, the value returned from settings.getInt(["server", "port"]) is still 5000.
What's the right way to get the port OctoPrint server is actually listening on inside a plugin?
I suppose @foosel would like to have your octoprint.log file.
I think I'd also wonder if you are trying to connect via IPv4 or IPv6. From my own naïve viewing of this code, it looks like it's hard-coded to 5000 but there's probably other stuff going on that's lost on me.
Actually, I love open-source software. Many times people ask questions about OctoPrint or a plugin and I can just read through the code and sound authoritative, as if I actually knew what I were talking about. ha