MCPcopy Index your code
hub / github.com/NVIDIA/TensorRT-LLM / bind

Method bind

tensorrt_llm/executor/rpc/rpc_server.py:91–115  ·  view source on GitHub ↗

Bind the server to the specified address. Args: address (str): The ZMQ address to bind the client-facing socket.

(self, address: str = "tcp://*:5555")

Source from the content-addressed store, hash-verified

89 self.shutdown()
90
91 def bind(self, address: str = "tcp://*:5555") -> None:
92 """
93 Bind the server to the specified address.
94
95 Args:
96 address (str): The ZMQ address to bind the client-facing socket.
97 """
98 self._address = address
99
100 # Check if PAIR mode is enabled via environment variable
101 use_pair_mode = os.environ.get('TLLM_LLMAPI_ZMQ_PAIR', '0') != '0'
102 socket_type = zmq.PAIR if use_pair_mode else zmq.ROUTER
103
104 if use_pair_mode:
105 logger_debug(
106 "[server] Using zmq.PAIR socket type for RPC communication")
107
108 self._client_socket = ZeroMqQueue(address=(address, self._hmac_key),
109 is_server=True,
110 is_async=True,
111 use_hmac_encryption=self._hmac_key
112 is not None,
113 socket_type=socket_type,
114 name="rpc_server")
115 logger.info(f"RPCServer is bound to {self._address}")
116
117 def shutdown(self, is_remote_call: bool = False) -> None:
118 """Internal method to trigger server shutdown.

Callers 15

test_rpc_shutdown_serverFunction · 0.95
main_taskMethod · 0.95
get_free_port_in_ciFunction · 0.80
is_port_availableFunction · 0.80
wait_for_port_releasedFunction · 0.80
router_socketMethod · 0.80
__enter__Method · 0.80
test_task_errorMethod · 0.80
test_rpc_benchmarkFunction · 0.80

Calls 4

logger_debugFunction · 0.85
ZeroMqQueueClass · 0.85
getMethod · 0.45
infoMethod · 0.45

Tested by 12

test_rpc_shutdown_serverFunction · 0.76
is_port_availableFunction · 0.64
wait_for_port_releasedFunction · 0.64
router_socketMethod · 0.64
__enter__Method · 0.64
test_task_errorMethod · 0.64
test_rpc_benchmarkFunction · 0.64
setup_methodMethod · 0.64
setup_methodMethod · 0.64