MCPcopy Create free account
hub / github.com/rthalley/dnspython / _net_read

Function _net_read

dns/query.py:1079–1097  ·  view source on GitHub ↗

Read the specified number of bytes from sock. Keep trying until we either get the desired amount, or we hit EOF. A Timeout exception will be raised if the operation is not completed by the expiration time.

(sock, count, expiration)

Source from the content-addressed store, hash-verified

1077
1078
1079def _net_read(sock, count, expiration):
1080 """Read the specified number of bytes from sock. Keep trying until we
1081 either get the desired amount, or we hit EOF.
1082 A Timeout exception will be raised if the operation is not completed
1083 by the expiration time.
1084 """
1085 s = b""
1086 while count > 0:
1087 try:
1088 n = sock.recv(count)
1089 if n == b"":
1090 raise EOFError("EOF")
1091 count -= len(n)
1092 s += n
1093 except (BlockingIOError, ssl.SSLWantReadError):
1094 _wait_for_readable(sock, expiration)
1095 except ssl.SSLWantWriteError: # pragma: no cover
1096 _wait_for_writable(sock, expiration)
1097 return s
1098
1099
1100def _net_write(sock, data, expiration):

Callers 2

receive_tcpFunction · 0.85
_inbound_xfrFunction · 0.85

Calls 3

_wait_for_readableFunction · 0.85
_wait_for_writableFunction · 0.85
recvMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…