code: def recvall(sock, nbytes):
      """Receive all nbytes from socket.
  
      Parameters
      ----------
      sock: Socket
         The socket
  
      nbytes : int
         Number of bytes to be received.
      """
      res = []
      nread = 0
      while nread < nbytes:
          chunk = sock.recv(min(nbytes - nread, 1024))
          if not chunk:
              raise IOError("connection reset")
          nread += len(chunk)
          res.append(chunk)
      return b"".join(res)
  
file_path: tvm/python/tvm/rpc/base.py
imports: import socket
  import time
  import json
  import errno
  import struct
  import random
  import logging
  from .._ffi.base import py_str
label_desc: Use image node_id 2 for calling a global function with example usage: recvall(sock, nbytes) and returns: bytes