MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / get_free_tcp_port

Function get_free_tcp_port

roach/utils/config_utils.py:141–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139
140
141def get_free_tcp_port():
142 s = socket.socket()
143 s.bind(("", 0)) # Request the sys to provide a free port dynamically
144 server_port = s.getsockname()[1]
145 s.close()
146 # 2000 works fine for now
147 server_port = 2000
148 return server_port

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected