MCPcopy Create free account
hub / github.com/ElementsProject/elements / recvall

Function recvall

test/functional/test_framework/socks5.py:24–33  ·  view source on GitHub ↗

Receive n bytes from a socket, or fail.

(s, n)

Source from the content-addressed store, hash-verified

22
23# Utility functions
24def recvall(s, n):
25 """Receive n bytes from a socket, or fail."""
26 rv = bytearray()
27 while n > 0:
28 d = s.recv(n)
29 if not d:
30 raise IOError('Unexpected end of stream')
31 rv.extend(d)
32 n -= len(d)
33 return rv
34
35# Implementation classes
36class Socks5Configuration():

Callers 1

handleMethod · 0.70

Calls 1

IOErrorFunction · 0.85

Tested by

no test coverage detected