title: Pyro4, receiving: not enough data
body: <p>I'm trying to run a function on the server with Pyro4.
  Have a look at the code:
  ==========================Client======================</p>
  
  <pre><code>import Pyro4
  def square(x): 
      return x**2
  remoteServer = Pyro4.Proxy('PYRONAME:server')
  print(remoteServer.evaluate(square, 4))
  </code></pre>
  
  <p>===========================Server==========================</p>
  
  <pre><code>import Pyro4
  class Server(object):
      def evaluate(self, func, args):
          return func(*args)
  
  def main():
      server = Server()
      Pyro4.Daemon.serveSimple({server: "server"},ns=True)
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>========================Naming Server========================</p>
  
  <pre><code>import Pyro4
  Pyro4.naming.startNSloop()
  </code></pre>
  
  <p>===========================================================</p>
  
  <p>And got an error: "<strong>Pyro4.errors.ConnectionClosedError: receiving: not enough data</strong>". Look at the full stack trace below:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "C:\Users\Alex\Desktop\2.py", line 9, in &lt;module&gt;
      print(remoteServer.evaluate(square, 4))
    File "C:\Users\Alex\AppData\Roaming\Python\Python34\site-packages\Pyro4\core.py", line 169, in __call__
      return self.__send(self.__name, args, kwargs)
    File "C:\Users\Alex\AppData\Roaming\Python\Python34\site-packages\Pyro4\core.py", line 380, in _pyroInvoke
      msg = message.Message.recv(self._pyroConnection, [message.MSG_RESULT], hmac_key=self._pyroHmacKey)
    File "C:\Users\Alex\AppData\Roaming\Python\Python34\site-packages\Pyro4\message.py", line 161, in recv
      msg = cls.from_header(connection.recv(cls.header_size))
    File "C:\Users\Alex\AppData\Roaming\Python\Python34\site-packages\Pyro4\socketutil.py", line 460, in recv
      return receiveData(self.sock, size)
    File "C:\Users\Alex\AppData\Roaming\Python\Python34\site-packages\Pyro4\socketutil.py", line 195, in receiveData
      raise err
  Pyro4.errors.ConnectionClosedError: receiving: not enough data
  </code></pre>
  
  <p>I want the server executes the function that is passed to a method (function).</p>
  
  <p>PS: Windows7, <strong>Python 3.4.1</strong></p>
  
  <p>I've found similar question (<a href="https://stackoverflow.com/questions/10564740/how-to-send-a-function-to-a-remote-pyro-object">How to send a function to a remote Pyro object</a>), but didn't work for me.
  Tried to use callback decorator @pyro4.callback, but even official example (<a href="https://github.com/delmic/Pyro4/tree/master/examples/callback" rel="nofollow noreferrer">https://github.com/delmic/Pyro4/tree/master/examples/callback</a>  : server2.py, client2.py) didn't work (with python 3.4 and python 2.7) => only message: "server: doing callback 1 to client" is showed and nothing happens.</p>
  
  <hr>
  
  <p>Thanks</p>