MCPcopy Index your code
hub / github.com/RustPython/RustPython / sock_connect

Method sock_connect

Lib/asyncio/selector_events.py:625–648  ·  view source on GitHub ↗

Connect to a remote socket at address. This method is a coroutine.

(self, sock, address)

Source from the content-addressed store, hash-verified

623 fut.set_result(n)
624
625 async def sock_connect(self, sock, address):
626 """Connect to a remote socket at address.
627
628 This method is a coroutine.
629 """
630 base_events._check_ssl_socket(sock)
631 if self._debug and sock.gettimeout() != 0:
632 raise ValueError("the socket must be non-blocking")
633
634 if sock.family == socket.AF_INET or (
635 base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
636 resolved = await self._ensure_resolved(
637 address, family=sock.family, type=sock.type, proto=sock.proto,
638 loop=self,
639 )
640 _, _, _, _, address = resolved[0]
641
642 fut = self.create_future()
643 self._sock_connect(fut, sock, address)
644 try:
645 return await fut
646 finally:
647 # Needed to break cycles when an exception occurs.
648 fut = None
649
650 def _sock_connect(self, fut, sock, address):
651 fd = sock.fileno()

Callers

nothing calls this directly

Calls 4

_sock_connectMethod · 0.95
_ensure_resolvedMethod · 0.80
gettimeoutMethod · 0.45
create_futureMethod · 0.45

Tested by

no test coverage detected