Skip to content

Commit 03b8989

Browse files
committed
made host binding optional
1 parent c13e99b commit 03b8989

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

godot_rl/core/godot_env.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def __init__(
6666
print("No game binary has been provided, please press PLAY in the Godot editor")
6767

6868
self.port = port
69+
self.host_binding = kwargs.get("host_binding", False)
6970
self.connection = self._start_server()
7071
self.num_envs = None
7172
self._handshake()
@@ -336,7 +337,8 @@ def _start_server(self):
336337
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
337338

338339
# Bind the socket to the port, "localhost" was not working on windows VM, had to use the IP
339-
server_address = ("0.0.0.0", self.port)
340+
address = "0.0.0.0" if self.host_binding else "127.0.0.1"
341+
server_address = (address, self.port)
340342
sock.bind(server_address)
341343

342344
# Listen for incoming connections

0 commit comments

Comments
 (0)