Interprocess Communication (IPC) Manager
Interprocess Communication (IPC) Manager to help create a Command structure for sending and receiving messages between processes.
Simple Listener/Client
# main.py
import ipc_mngr
def msg_handler(sock, cmd):
"""Handle received commands.
Args:
sock (multiprocessing.connection.Client): Client socket that received the command.
cmd (object): Command object that was received.
"""
print('Received Command:', cmd)
listener = ipc_mngr.Listener(('127.0.0.1', 8111), authkey='12345')
listener.msg_handler = msg_handler
print("listening ...")
listener.listen() # Listen forever
# send_cmd.py
import ipc_mngr
with ipc_mngr.Client(('127.0.0.1', 8111), authkey='12345') as client:
# Send the command
client.send("Hello World!")
Schedule Example
See tests/schedule_run directory for how to use this as a permanent job scheduler.
Stream Audio Example
See tests/stream_audio directory for how to use the Streamer and StreamClient class.
import ipc_mngr
with ipc_mngr.Streamer(('127.0.0.1', 8222), authkey='12345') as streamer:
while True:
streamer.broadcast(1) # streamer.stream(1)
import ipc_mngr
import time
SECONDS = 5
data = []
def save_data(client, value):
data.append(value)
with ipc_mngr.StreamClient(('127.0.0.1', 8222), authkey='12345') as client:
start = time.time()
client.stream_handler = save_data
# Save data for 5 seconds
while time.time() - start < SECONDS:
time.sleep(1)
print('Collected {} samples'.format(len(data)))
Metadata
Release files for ipc-mngr 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ipc_mngr-1.0.1.tar.gz | 10.3 kB | Without provenance | Details for ipc_mngr-1.0.1.tar.gz |
Release files / ipc_mngr-1.0.1.tar.gz
| Download URL | ipc_mngr-1.0.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d53b1dd0b9c01ff584c108c9e23a9783166fc5239273a99bdab5550064f0837c
|
|
BLAKE2b-256 checksum How to use checksums |
078269a85136820365158c4355eb8085b7923dec0ee60646cc657f8dc48929a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
|
Security for ipc-mngr 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.