class_docstr: Abstract class w/ length-prefixed socket send/receive functions.
docstr: Receive a message on ``sock``.
docstr_tok: ["Receive","a","message","on","``","sock","``","."]
code: def receive(self, sock):
      """Receive a message on ``sock``."""
      msg = None
      data = b""
      recv_done = False
      recv_len = -1
      while not recv_done:
          buf = sock.recv(BUFSIZE)
          if buf is None or len(buf) == 0:
              raise Exception("socket closed")
          if recv_len == -1:
              recv_len = struct.unpack(">I", buf[:4])[0]
              data += buf[4:]
              recv_len -= len(data)
          else:
              data += buf
              recv_len -= len(buf)
          recv_done = recv_len == 0
  
      msg = pickle.loads(data)
      return msg
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import nested_scopes
  from __future__ import print_function
  import logging
  import os
  import pickle
  import select
  import socket
  import struct
  import sys
  import threading
  import time
  from .None import util
label_desc: Use image node_id 1 for calling the MessageSocket obj's underlying member method code with example usage: obj.receive(sock) and returns: msg