MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / select_and_bind

Method select_and_bind

lightx2v/utils/va_reader_omni.py:162–176  ·  view source on GitHub ↗
(socket: zmq.Socket)

Source from the content-addressed store, hash-verified

160
161 @staticmethod
162 def select_and_bind(socket: zmq.Socket) -> str:
163 # randomly select a port between 1024 and 6553
164 retry_count = 20
165 err = None
166 while retry_count > 0:
167 try:
168 port = random.randint(1024, 65535)
169 # port = 5555
170 url = f"tcp://localhost:{port}"
171 socket.bind(url)
172 return url
173 except zmq.error.ZMQError as e:
174 retry_count -= 1
175 err = e
176 raise err
177
178 # immediate switch to status, discard prev_bytes, set immediate_switch to 1
179 def immediate_switch_to(self, status):

Callers 1

__init__Method · 0.80

Calls 1

bindMethod · 0.80

Tested by

no test coverage detected