python icon indicating copy to clipboard operation
python copied to clipboard

specify TCP port number

Open adrianTNT opened this issue 4 weeks ago • 3 comments

Hello. I was trying to connect to multiple nodes on same public ip address (yes over internet, yes, it is not secure). // I don't think there is any auth for that, no?

Anyway ... When I connect and specify --host, the --port there is not TCP port nubmer, but serial/usb local hardware port path, no?

--port [PORT], --serial [PORT], -s [PORT]
                        The port of the device to connect to using serial, e.g. /dev/ttyUSB0. (defaults to trying to detect a port)
--host [HOST], --tcp [HOST], -t [HOST]
                        Connect to a device using TCP, optionally passing hostname or IP address to use. (defaults to 'localhost')

Is there any way I can specify different TCP port for my connections? e.g I was trying:

meshtastic --host my.public.hostname --port 4403 --info
meshtastic --host my.public.hostname --port 4404 --info
meshtastic --host my.public.hostname --port 4405 --info

Maybe meshtastic cli source can be altered to add something like --tcp-port? I was working on an a web interface for meshtastic (PHP and linux on back end) and secifying TCP port seems critical.

adrianTNT avatar Nov 28 '25 20:11 adrianTNT

yeah --port is the serial device, for IP you just append the tcp/ip port to the IP ala --host 1.2.3.4:4403 (which the help text could call out instead of just referring to IP address)

also: you may find use from the --no-nodes arg to skip sending the entire nodeDB

porkcube avatar Nov 28 '25 23:11 porkcube

@porkcube thank you, that helps a lot.

I had a quick attempt to add the port clarification to --help but Github functions confuse me.

If someone wants to edit there or let me know how to "push" a change, I think this is the location: https://github.dev/meshtastic/python/blob/5cc0dae3947cd72f5a05d079a93751fc924afac6/meshtastic/main.py#L1486

adrianTNT avatar Nov 28 '25 23:11 adrianTNT

Hi adrian, you need to create a pull request - common way for all open source projects on GitHub. Roughly:

  • create a fork of meshtastic/python, this will create a new repo in your account.
  • do your work and push it to your fork, best in a branch
  • then create the pull request from your forked repo into meshtastic.

juergenRe avatar Dec 04 '25 14:12 juergenRe