{ "info": { "author": "SamHDev", "author_email": "sam02h.huddart@gmail.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# TCP Non-Block\nA Simple Implementation of Non-Blocking TCP Socket Server. \n\n## Key Features\n\n * Simple to Use\n * Threading Built In\n * Expandable - Does'nt use a thread per connection\n * Stress Tested - Can handle 100+ connections (tested on a [OVH VPS SSD 1](https://www.ovh.co.uk/vps/vps-ssd.xml))\n\n## Installation\nYou can install via python's `pip` module:\n\nInstall with Offical Python Package Index:\n```bash\npython3 -m pip install tcpnonblock\n```\nor with this Git Respiratory\n```bash\npython3 -m pip install git+https://github.com/SamHDev/tcpnonblock.git\n```\n*Note for Noobies: If `python3` work then use `python`*\n\n\n## Usage\n\nYou can import the libary with the following statement:\n```py\nimport tcpnonblock\n```\n\n### Server Example\nHere is a quick Example of a TCPSocket Server. This is an [Echo Server](/demos/echo/server.py) that replies the message from a client.\n```py\nserver = tcpnonblock.TCPSocketServer() # Create a Server Object\n\n# Create a Client Instance for the Server\n@server.client_instance\nclass ClientInstance(tcpnonblock.TCPSocketServerInstance):\n # On Client Connect\n def connect(self):\n print(\"Client Connected\")\n\n # On Client Disconnect\n def disconnect(self):\n print(\"Client Disconnected\")\n\n # On Client Message\n def message(self, msg):\n print(\"Client Message: \",msg)\n self.send(\"You Said: \", msg) # Echo the Message (Send)\n\n# On Server Start Event\n@server.on_start\ndef start(host, port):\n print(\"Server Start\")\n\n# On Server Stop Event\n@server.on_stop\ndef stop():\n print(\"Server Stop\")\n\n# Start the Server\nserver.listen(\"0.0.0.0\", 8080) # Host,Port\nserver.start()\n```\n\n### Client Example\nHere is a quick Example of a TCPSocket Client to go with our Echo Server. This is an [Echo Client](/demos/echo/client.py) that interacts with our Example.\n```py\nclient = remote.TCPSocketClient() # Create a Client Object\n\n# On Client Connected to Server\n@client.on_open\ndef on_open():\n print(\"Connected to Server\")\n client.send(\"Hello World!\")\n\n# On Client Disconnected from Server\n@client.on_close\ndef on_close():\n print(\"Disconnected to Server\")\n\n# On Server Message Received\n@client.on_message\ndef on_message(msg):\n print(\"Reply: \", msg) #`Msg` is a `string`\n\nclient.connect(\"localhost\", 8080)\n```\n\n### Threading\n\nWhat about that threading I mentioned earlier, well its this simple. \nJust declare the `threading` argument in the creation of the object.\nIt works for both `TCPSocketServer` and `TCPSocketClient`\n\n```py\nserver = tcpnonblock.TCPSocketServer(threaded=True)\nclient = rtcpnonblock.TCPSocketClient(threaded=True)\n```\n\nThe Thread will be created and started on `.start()`\n\n## License and Attributes\n\nCreated by Sam Huddart under alias [SamHDev](https://github.com/SamHDev/) for the [Blume Open Source Project](https://www.youtube.com/watch?v=oHg5SJYRHA0). `SamHDev/tcpnonblock` is licensed under the GNU General Public License v3.0 and is Open-Source as seen in [LICENSE](LICENSE). Commercial use, Modification and Distribution are permmited. Although credit is not necessary, it is much obliged. If you do wish to credit the author, please link the [respiratory](https://github.com/SamHDev/tcpnonblock/) and the author at [github](https://github.com/SamHDev/) or [website](https://samhdev.com). Thank you for using our work.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SamHDev/tcpnonblock", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tcpnonblock", "package_url": "https://pypi.org/project/tcpnonblock/", "platform": "", "project_url": "https://pypi.org/project/tcpnonblock/", "project_urls": { "Homepage": "https://github.com/SamHDev/tcpnonblock" }, "release_url": "https://pypi.org/project/tcpnonblock/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "A Simple Implementation of Non-Blocking TCP Socket Server.", "version": "0.1.1" }, "last_serial": 5739246, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "705075b024d923510e236eabfd5219c7", "sha256": "1e15744966a6878066ce9b4ad9fddbb0a15d641fc82afaf716a5e94dfdd61ffb" }, "downloads": -1, "filename": "tcpnonblock-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "705075b024d923510e236eabfd5219c7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17581, "upload_time": "2019-08-27T19:54:30", "url": "https://files.pythonhosted.org/packages/8a/28/30a59e108e2c75dd9be03dc675dfb2490dc4ee89b9543fa7940a04740da9/tcpnonblock-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb433181561966b7765407af900308c0", "sha256": "c44e7e0cf8986f8b9961ede9b891863a70d6c9468d4c2e3d4b96f59fe6e16b39" }, "downloads": -1, "filename": "tcpnonblock-0.1.1.tar.gz", "has_sig": false, "md5_digest": "eb433181561966b7765407af900308c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4151, "upload_time": "2019-08-27T19:54:32", "url": "https://files.pythonhosted.org/packages/55/f5/f1f15a1e020be64642ba620769bfd42f68c627d84e9feab3ef1516b7f029/tcpnonblock-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "705075b024d923510e236eabfd5219c7", "sha256": "1e15744966a6878066ce9b4ad9fddbb0a15d641fc82afaf716a5e94dfdd61ffb" }, "downloads": -1, "filename": "tcpnonblock-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "705075b024d923510e236eabfd5219c7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17581, "upload_time": "2019-08-27T19:54:30", "url": "https://files.pythonhosted.org/packages/8a/28/30a59e108e2c75dd9be03dc675dfb2490dc4ee89b9543fa7940a04740da9/tcpnonblock-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb433181561966b7765407af900308c0", "sha256": "c44e7e0cf8986f8b9961ede9b891863a70d6c9468d4c2e3d4b96f59fe6e16b39" }, "downloads": -1, "filename": "tcpnonblock-0.1.1.tar.gz", "has_sig": false, "md5_digest": "eb433181561966b7765407af900308c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4151, "upload_time": "2019-08-27T19:54:32", "url": "https://files.pythonhosted.org/packages/55/f5/f1f15a1e020be64642ba620769bfd42f68c627d84e9feab3ef1516b7f029/tcpnonblock-0.1.1.tar.gz" } ] }