{ "info": { "author": "Brian Muller", "author_email": "bamuller@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# RPCUDP : [RPC](http://en.wikipedia.org/wiki/Remote_procedure_call) over [UDP](http://en.wikipedia.org/wiki/User_Datagram_Protocol) in Python\n\nRPC over UDP may seem like a silly idea, but things like the [DHT](http://en.wikipedia.org/wiki/Distributed_hash_table) [Kademlia](http://en.wikipedia.org/wiki/Kademlia) require it. This project is specifically designed for asynchronous [Python Twisted](http://twistedmatrix.com) code to accept and send remote proceedure calls.\n\nBecause of the use of UDP, you will not always know whether or not a procedure call was successfully received. This isn't considered an exception state in the library, though you will know if a response isn't received by the server in a configurable amount of time.\n\n## Installation\n\n```\npip install storjrpcudp\n```\n\n## Usage\n*This assumes you have a working familiarity with Twisted.*\n\nFirst, let's make a server that accepts a remote procedure call and spin it up.\n\n```python\nfrom rpcudp.protocol import RPCProtocol\nfrom twisted.internet import reactor\n\nclass RPCServer(RPCProtocol):\n # Any methods starting with \"rpc_\" are available to clients.\n def rpc_sayhi(self, sender, name):\n # This could return a Deferred as well. sender is (ip,port)\n return \"Hello %s you live at %s:%i\" % (name, sender[0], sender[1])\n\n# start a server on UDP port 1234\nreactor.listenUDP(1234, RPCServer())\nreactor.run()\n```\n\nNow, let's make a client. Note that we do need to specify a port for the client as well, since it needs to listen for responses to RPC calls on a UDP port.\n\n```python\nfrom rpcudp.protocol import RPCProtocol\nfrom twisted.internet import reactor\n\nclass RPCClient(RPCProtocol):\n def handleResult(self, result):\n \t# result will be a tuple - first arg is a boolean indicating whether a response\n # was received, and the second argument is the response if one was received.\n if result[0]:\n print \"Success! %s\" % result[1]\n else:\n print \"Response not received.\"\n\nclient = RPCClient()\nreactor.listenUDP(5678, client)\nclient.sayhi(('127.0.0.1', 1234), \"Snake Plissken\").addCallback(client.handleResult)\nreactor.run()\n```\n\nYou can run this example in the example.py file in the root folder.\n\n## Implementation Details\nThe protocol is designed to be as small and fast as possible. Python objects are serialized using [MsgPack](http://msgpack.org/). All calls must fit within 8K (generally small enough to fit in one datagram packet).\n\n## Compatibility\nWith version 2.0 compatibility is broken with previous versions. In version 2.0 the method name when making a remote call is always packed as a unicode string. In previous versions, the type of string that method name was depended on the Python version. In order to make instances running on Python 2 and Python 3 compatible with each other the method name is now encoded as a unicode string before being packed, which ensures that [u-msgpack-python](https://github.com/vsergeev/u-msgpack-python) will always pack the it the same way. See [u-msgpack-python#behaviour-notes](https://github.com/vsergeev/u-msgpack-python#behavior-notes) for more information.\n\nIf you intend to have instances running on both Python 2 and Python 3 communicating with each other make sure that all strings in the arguments you send are unicode encoded as well to ensure compatibility.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Storj/storjrpcudp", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "storjrpcudp", "package_url": "https://pypi.org/project/storjrpcudp/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/storjrpcudp/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Storj/storjrpcudp" }, "release_url": "https://pypi.org/project/storjrpcudp/2.5/", "requires_dist": null, "requires_python": null, "summary": "RPC via UDP", "version": "2.5" }, "last_serial": 1934001, "releases": { "2.2": [ { "comment_text": "", "digests": { "md5": "59462ae852937a7b54e34ff7db2e3460", "sha256": "0112158fe4c646c94adec72faa4b9a70be809a8d80a9dafefe8e3dc38dea8cfb" }, "downloads": -1, "filename": "storjrpcudp-2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "59462ae852937a7b54e34ff7db2e3460", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8678, "upload_time": "2016-01-29T20:34:24", "url": "https://files.pythonhosted.org/packages/77/8f/9bb21ac58388aea375236eb324246684ecbbab224918854e2fa91ab94224/storjrpcudp-2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b5fddd914a7158f371fc6baf6aec31a4", "sha256": "8cfd0e213a2f1b7d7f251c5cb8cca7889be5cc0cb1ca83f9097ca9b4ad409594" }, "downloads": -1, "filename": "storjrpcudp-2.2.tar.gz", "has_sig": false, "md5_digest": "b5fddd914a7158f371fc6baf6aec31a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3904, "upload_time": "2016-01-29T20:34:13", "url": "https://files.pythonhosted.org/packages/7c/18/b800285418f3ea099d9ab98ce19f07b28209adc9db608a3fc0e38fa66d0a/storjrpcudp-2.2.tar.gz" } ], "2.3": [ { "comment_text": "", "digests": { "md5": "9abadca92fecb478dbf0b9d0e370e89a", "sha256": "2b92c7dfeb012582e38ee47978ba589d45faac73509d366b594e6729ea7d731c" }, "downloads": -1, "filename": "storjrpcudp-2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9abadca92fecb478dbf0b9d0e370e89a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8717, "upload_time": "2016-01-30T17:05:25", "url": "https://files.pythonhosted.org/packages/e8/31/1fcd4549bd020b986a2ceb6321be44e78f65488b18c28101dde3f0191781/storjrpcudp-2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8eea37344d5687f1290e42c367aec999", "sha256": "424e0074e1dab8cd7e28c6624720ad8d2d3bd1366ad34bfd89a5f5f10c99ad96" }, "downloads": -1, "filename": "storjrpcudp-2.3.tar.gz", "has_sig": false, "md5_digest": "8eea37344d5687f1290e42c367aec999", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3951, "upload_time": "2016-01-30T17:05:21", "url": "https://files.pythonhosted.org/packages/ef/78/6c8ffd8b4eabd721b0c406006ebd6e4490d94a631e2eb729dbf530835d46/storjrpcudp-2.3.tar.gz" } ], "2.4": [ { "comment_text": "", "digests": { "md5": "59a54e6e235f2d354d3cfaec6f74e442", "sha256": "d0e28c83f13a4df86b31d32aced8076c6b9204fbdff280f1ec76d321dd0575f7" }, "downloads": -1, "filename": "storjrpcudp-2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "59a54e6e235f2d354d3cfaec6f74e442", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8835, "upload_time": "2016-01-31T00:05:36", "url": "https://files.pythonhosted.org/packages/59/de/3516b958e139f384d8d1dc8e86e8071433dbe80716feb48f27a3b95c23f1/storjrpcudp-2.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0fd0cebcde752f7634dc8d2c18e9c051", "sha256": "270c0f1adabcc451239d9b38ac678ecad4556f97492d93a9e14a83c2e9083d1c" }, "downloads": -1, "filename": "storjrpcudp-2.4.tar.gz", "has_sig": false, "md5_digest": "0fd0cebcde752f7634dc8d2c18e9c051", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4060, "upload_time": "2016-01-31T00:05:22", "url": "https://files.pythonhosted.org/packages/7a/3c/3be3a0aacf20a27ac0167210e847aa79662e7129cebf6b88e3408367e5ab/storjrpcudp-2.4.tar.gz" } ], "2.5": [ { "comment_text": "", "digests": { "md5": "ad991c46013b4d952bf8403e6e07da87", "sha256": "a14241a528b32d0d4378230d5a1475a628e4294865e056bbc4b127fe14029ae4" }, "downloads": -1, "filename": "storjrpcudp-2.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad991c46013b4d952bf8403e6e07da87", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8838, "upload_time": "2016-02-01T16:12:43", "url": "https://files.pythonhosted.org/packages/f7/2b/8332c4e9763143766343fa9d20ab91e7a0d41b2fa5510d16dee31bbc8576/storjrpcudp-2.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "012418406b402f57e8f8718af424257c", "sha256": "2bbb0864795783ece1d4134f7b2f3e1d3725b063a94cb6cf129667fe4db13ec1" }, "downloads": -1, "filename": "storjrpcudp-2.5.tar.gz", "has_sig": false, "md5_digest": "012418406b402f57e8f8718af424257c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4066, "upload_time": "2016-02-01T16:12:36", "url": "https://files.pythonhosted.org/packages/5d/24/71391214910416ac5debc72d0cb905a6e9d7582497c06761bb25ded9c7fd/storjrpcudp-2.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad991c46013b4d952bf8403e6e07da87", "sha256": "a14241a528b32d0d4378230d5a1475a628e4294865e056bbc4b127fe14029ae4" }, "downloads": -1, "filename": "storjrpcudp-2.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad991c46013b4d952bf8403e6e07da87", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8838, "upload_time": "2016-02-01T16:12:43", "url": "https://files.pythonhosted.org/packages/f7/2b/8332c4e9763143766343fa9d20ab91e7a0d41b2fa5510d16dee31bbc8576/storjrpcudp-2.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "012418406b402f57e8f8718af424257c", "sha256": "2bbb0864795783ece1d4134f7b2f3e1d3725b063a94cb6cf129667fe4db13ec1" }, "downloads": -1, "filename": "storjrpcudp-2.5.tar.gz", "has_sig": false, "md5_digest": "012418406b402f57e8f8718af424257c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4066, "upload_time": "2016-02-01T16:12:36", "url": "https://files.pythonhosted.org/packages/5d/24/71391214910416ac5debc72d0cb905a6e9d7582497c06761bb25ded9c7fd/storjrpcudp-2.5.tar.gz" } ] }