MCPcopy
hub / github.com/zeromq/pyzmq / connect

Method connect

zmq/sugar/socket.py:326–350  ·  view source on GitHub ↗

s.connect(addr) Connect to a remote 0MQ socket. Returns a context manager which will call disconnect on exit. .. versionadded:: 20.0 Can be used as a context manager. Parameters ---------- addr : str The address string. This

(self: _SocketType, addr: str)

Source from the content-addressed store, hash-verified

324 return self._bind_cm(addr)
325
326 def connect(self: _SocketType, addr: str) -> _SocketContext[_SocketType]:
327 """s.connect(addr)
328
329 Connect to a remote 0MQ socket.
330
331 Returns a context manager which will call disconnect on exit.
332
333 .. versionadded:: 20.0
334 Can be used as a context manager.
335
336 Parameters
337 ----------
338 addr : str
339 The address string. This has the form 'protocol://interface:port',
340 for example 'tcp://127.0.0.1:5555'. Protocols supported are
341 tcp, udp, pgm, inproc and ipc. If the address is unicode, it is
342 encoded to utf-8 first.
343
344 """
345 try:
346 super().connect(addr)
347 except ZMQError as e:
348 e.strerror += f" (addr={addr!r})"
349 raise
350 return self._connect_cm(addr)
351
352 # -------------------------------------------------------------------------
353 # Deprecated aliases

Callers 15

_stopMethod · 0.45
_push_socketMethod · 0.45
_setup_socketsMethod · 0.45
_setup_socketsMethod · 0.45
_setup_socketsMethod · 0.45
startMethod · 0.45
__main__.pyFile · 0.45
tunnel_connectionFunction · 0.45
_paramiko_tunnelFunction · 0.45
create_bound_pairMethod · 0.45
get_monitor_socketMethod · 0.45

Calls 1

_connect_cmMethod · 0.95

Tested by 15

mainFunction · 0.36
test_proxy_steerableMethod · 0.36
testMethod · 0.36
test_retry_termMethod · 0.36
test_router_routerMethod · 0.36
test_proxyMethod · 0.36
test_green_deviceMethod · 0.36
test_context_managerMethod · 0.36