TCP connections: Only listen to localhost, not all interfaces

This commit is contained in:
Morten Minde Neergaard 2022-11-01 15:30:30 +01:00
parent 853b8e2d53
commit 513e44d128
4 changed files with 4 additions and 4 deletions

View file

@ -109,7 +109,7 @@ func _shell_binary():
#func run_async_thread(command): #func run_async_thread(command):
# var port = 1000 + (randi() % 1000) # var port = 1000 + (randi() % 1000)
# var s = TCP_Server.new() # var s = TCP_Server.new()
# s.listen(port) # s.listen(port, "127.0.0.1")
# var _pid = OS.execute("ncat", ["127.0.0.1", str(port), "-c", command], false, [], true) # var _pid = OS.execute("ncat", ["127.0.0.1", str(port), "-c", command], false, [], true)
# while not s.is_connection_available(): # while not s.is_connection_available():
# pass # pass

View file

@ -13,7 +13,7 @@ func _ready():
start() start()
func start(): func start():
_s.listen(port) _s.listen(port, "127.0.0.1")
func _process(_delta): func _process(_delta):
if _s.is_connection_available(): if _s.is_connection_available():

View file

@ -13,7 +13,7 @@ func _ready():
start() start()
func start(): func start():
_s.listen(port) _s.listen(port, "127.0.0.1")
func _process(_delta): func _process(_delta):
if _s.is_connection_available(): if _s.is_connection_available():

View file

@ -10,7 +10,7 @@ var _client_connection
func _ready(): func _ready():
# Initialize TCP server for fake editor. # Initialize TCP server for fake editor.
_server = TCP_Server.new() _server = TCP_Server.new()
_server.listen(1234) _server.listen(1234, "127.0.0.1")
func _process(_delta): func _process(_delta):
if _server.is_connection_available(): if _server.is_connection_available():