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)
| 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 |