title: Python Processes Dict Sending Over Socket
body: <p>I have processes set up like</p>
  
  <pre><code>manager = Manager();
  
  nodes = manager.dict();
  
  p1 = Process(target = advertise, args=(nodes,));
  p1.start();
  p2 = Process(target = receive, args=(nodes,));
  p2.start();
  
  def advertise(nodes):
      while(1):
          nts = json.dumps(nodes.copy());
          for k, v in nodes.items():
              # Creates a UDP socket
              mySocket = createSocket(getMyIP(), PORT);
              mySocket.connect((getMyIP(), v[1]));
              mySocket.send(("AD||" + nts).encode("ASCII"));
              mySocket.close();
          time.sleep(5);
  
  def receive(nodes):
      while(1):
          mySocket = createSocket(getMyIP(), PORT);
          mySocket.bind((getMyIP(), PORT));
          try:
              data = mySocket.recv(4096).decode("ASCII").split("||");
              if(data[0] == "AD"):
                  temp = json.loads(data[1]);
                  #print("Received: " + str(temp));
              for k, v in temp.items():
                  nodes[k] = [float(v[0]), int(v[1])];
          except:
              mySocket.close();
  </code></pre>
  
  <p>One of which receives a dict and updates values, one of which sends out a dict.
  I can't json.dumps(nodes) because it says DictProxy is not jsondumpable, so I did nts = json.dumps(nodes.copy());</p>
  
  <p>This works for the first time (the socket sends the dictionary correctly) but the second time the program just says </p>
  
  <pre><code>File "Dvr.py", line 40, in advertise
      nts = json.dumps(nodes.copy());
  File "&lt;string&gt;", line 2, in copy
  File "/usr/lib/python2.7/multiprocessing/managers.py", line 758, in _callmethod
      conn.send((self._id, methodname, args, kwds))
  IOError: [Errno 32] Broken pipe
  </code></pre>
  
  <p><strong>1) Why does this only work for the first time the while loop loops?</strong></p>
  
  <p><strong>2) How do I make it work everytime?</strong></p>