# Inter-Process Communications (IPC)
![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/ipc)
[![Latest Version](https://img.shields.io/pypi/v/ipcpy.svg)](https://pypi.python.org/pypi/ipcpy/)
[![image](https://img.shields.io/pypi/pyversions/ipcpy.svg)](https://pypi.python.org/pypi/ipcpy)
[![image](https://img.shields.io/pypi/format/ipcpy.svg)](https://pypi.python.org/pypi/ipcpy)
![PyPI - Downloads](https://img.shields.io/pypi/dm/ipcpy?color=aqua)
A simple library to allow processes to use UDP to communicate
with each other.
This is yet again another rehash of old work in a new way ... I keep
reinventing the wheel. :)
**in development**
## Example
``` python
import ipcpy as ipc
from collections import namedtuple
Msg = namedtuple("Msg","a b c")
d = {
22: ("i", int),
23: ("iii", Msg),
}
msglib = MsgLibrary(d)
run = True
def client():
global run
print("Client started")
s = ipc.SocketUDP()
s.open(TIMEOUT)
for i in range(10):
pkt = msglib.pack(MSG_ID_INT, [i])
print(f"send: {pkt}")
s.sendto(pkt, (HOST,PORT))
time.sleep(0.25)
# print('.')
run = False
def server():
global run
print("Client started")
s = ipc.SocketUDP()
s.bind(HOST,PORT,TIMEOUT)
while run:
data, address = s.recvfrom(MSG_SIZE)
if data is not None:
id, info = ipc.get_msg(data)
if id is not None:
msg = msglib.unpack(id, info)
print(f"recvfrom: {address} {info} {msg}")
else:
print(f"ERROR: {info}")
```
# MIT License
**Copyright (c) 2003 Kevin J. Walchko**
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/ipcpy/",
"name": "ipcpy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "udp, ipc, interprocess communication",
"author": "walchko",
"author_email": "walchko@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/f2/35/ed7b145053699399fb1e4639b4b47fd75d255440923e5ec35d4d320e5923/ipcpy-2024.11.10.2.tar.gz",
"platform": null,
"description": "# Inter-Process Communications (IPC)\n![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/ipc)\n[![Latest Version](https://img.shields.io/pypi/v/ipcpy.svg)](https://pypi.python.org/pypi/ipcpy/)\n[![image](https://img.shields.io/pypi/pyversions/ipcpy.svg)](https://pypi.python.org/pypi/ipcpy)\n[![image](https://img.shields.io/pypi/format/ipcpy.svg)](https://pypi.python.org/pypi/ipcpy)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/ipcpy?color=aqua)\n\n\nA simple library to allow processes to use UDP to communicate\nwith each other.\n\nThis is yet again another rehash of old work in a new way ... I keep\nreinventing the wheel. :)\n\n**in development**\n\n## Example\n\n``` python\nimport ipcpy as ipc\nfrom collections import namedtuple\n\nMsg = namedtuple(\"Msg\",\"a b c\")\n\nd = {\n 22: (\"i\", int),\n 23: (\"iii\", Msg),\n}\n\nmsglib = MsgLibrary(d)\nrun = True\n\ndef client():\n global run\n print(\"Client started\")\n s = ipc.SocketUDP()\n s.open(TIMEOUT)\n\n for i in range(10):\n pkt = msglib.pack(MSG_ID_INT, [i])\n print(f\"send: {pkt}\")\n s.sendto(pkt, (HOST,PORT))\n time.sleep(0.25)\n # print('.')\n\n run = False\n\ndef server():\n global run\n print(\"Client started\")\n s = ipc.SocketUDP()\n s.bind(HOST,PORT,TIMEOUT)\n\n while run:\n data, address = s.recvfrom(MSG_SIZE)\n if data is not None:\n id, info = ipc.get_msg(data)\n if id is not None:\n msg = msglib.unpack(id, info)\n print(f\"recvfrom: {address} {info} {msg}\")\n else:\n print(f\"ERROR: {info}\")\n\n```\n\n# MIT License\n\n**Copyright (c) 2003 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A interprocess communications (IPC) framework using UDP",
"version": "2024.11.10.2",
"project_urls": {
"Homepage": "https://pypi.org/project/ipcpy/",
"Repository": "https://github.com/MomsFriendlyRobotCompany/ipc/python"
},
"split_keywords": [
"udp",
" ipc",
" interprocess communication"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f98e5ffae3ad025b62c22a4dfed304a8967fa8a21b9ddd68410ba018528da261",
"md5": "661ca51c3de3e72574a15d88c38e2453",
"sha256": "7b0fa8dc4bc91801df4cc7ba97dc2ced79dd1329d833e13c6adae49c16ba9048"
},
"downloads": -1,
"filename": "ipcpy-2024.11.10.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "661ca51c3de3e72574a15d88c38e2453",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6359,
"upload_time": "2024-11-10T19:07:00",
"upload_time_iso_8601": "2024-11-10T19:07:00.176010Z",
"url": "https://files.pythonhosted.org/packages/f9/8e/5ffae3ad025b62c22a4dfed304a8967fa8a21b9ddd68410ba018528da261/ipcpy-2024.11.10.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f235ed7b145053699399fb1e4639b4b47fd75d255440923e5ec35d4d320e5923",
"md5": "7d6f5ef4534e96689a8e030d222319c8",
"sha256": "1deb573ab114a88340ee21fd6b00448f1e06b73f77629b2eaa0acf78734174d2"
},
"downloads": -1,
"filename": "ipcpy-2024.11.10.2.tar.gz",
"has_sig": false,
"md5_digest": "7d6f5ef4534e96689a8e030d222319c8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5326,
"upload_time": "2024-11-10T19:07:01",
"upload_time_iso_8601": "2024-11-10T19:07:01.029803Z",
"url": "https://files.pythonhosted.org/packages/f2/35/ed7b145053699399fb1e4639b4b47fd75d255440923e5ec35d4d320e5923/ipcpy-2024.11.10.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-10 19:07:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MomsFriendlyRobotCompany",
"github_project": "ipc",
"github_not_found": true,
"lcname": "ipcpy"
}