.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python_packages\others\demoPyro4.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_packages_others_demoPyro4.py: Pyro4 ======== This demo shows an example on how to the Pyro4 package. .. GENERATED FROM PYTHON SOURCE LINES 6-11 .. code-block:: Python import Pyro4 import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 13-14 Define random generator class and register the host. .. GENERATED FROM PYTHON SOURCE LINES 14-24 .. code-block:: Python class RandGenerator: def getRand(self, x, y): return list(np.random.rand(y, x)) daemon = Pyro4.Daemon(host="129.69.65.61", port=12000) uri = daemon.register(RandGenerator(), "123456") print("uri=", uri) daemon.requestLoop() .. GENERATED FROM PYTHON SOURCE LINES 25-26 In Order to get it from another computer use following code: .. GENERATED FROM PYTHON SOURCE LINES 26-30 .. code-block:: Python import Pyro4 thing = Pyro4.Proxy("PYRO:123456@129.69.65.61:12000") print(thing.getRand(42, 43)) .. _sphx_glr_download_11_demos_python_packages_others_demoPyro4.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demoPyro4.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demoPyro4.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demoPyro4.zip `