mirror of
https://github.com/meshtastic/python.git
synced 2026-01-12 01:37:58 -05:00
Merge pull request #673 from djholt/feature/tcp-port
Allow port number to be specified with tcp hostname
This commit is contained in:
@@ -1162,8 +1162,14 @@ def common():
|
||||
)
|
||||
elif args.host:
|
||||
try:
|
||||
if ":" in args.host:
|
||||
tcp_hostname, tcp_port = args.host.split(':')
|
||||
else:
|
||||
tcp_hostname = args.host
|
||||
tcp_port = meshtastic.tcp_interface.DEFAULT_TCP_PORT
|
||||
client = meshtastic.tcp_interface.TCPInterface(
|
||||
args.host,
|
||||
tcp_hostname,
|
||||
portNumber=tcp_port,
|
||||
debugOut=logfile,
|
||||
noProto=args.noproto,
|
||||
noNodes=args.no_nodes,
|
||||
|
||||
@@ -6,6 +6,7 @@ from typing import Optional
|
||||
|
||||
from meshtastic.stream_interface import StreamInterface
|
||||
|
||||
DEFAULT_TCP_PORT = 4403
|
||||
|
||||
class TCPInterface(StreamInterface):
|
||||
"""Interface class for meshtastic devices over a TCP link"""
|
||||
@@ -16,7 +17,7 @@ class TCPInterface(StreamInterface):
|
||||
debugOut=None,
|
||||
noProto=False,
|
||||
connectNow=True,
|
||||
portNumber=4403,
|
||||
portNumber=DEFAULT_TCP_PORT,
|
||||
noNodes:bool=False,
|
||||
):
|
||||
"""Constructor, opens a connection to a specified IP address/hostname
|
||||
|
||||
Reference in New Issue
Block a user