Skip to main content

pywinpipe - Fast data exchange between 2 processes (Windows only)

pip install pywinpipe

The pywinpipe module with the 2 classes: Write2Pipe and ReadFromPipe can be beneficial for people who need to establish inter-process communication (IPC) between different programs or components on a Windows system.

By utilizing named pipes, this module enables communication through a simple and efficient mechanism. Some potential beneficiaries of this module include:

Client-Server Applications: The module allows for communication between a client and a server process, facilitating data exchange and coordination between the two.

Inter-Process Communication: Developers can use this module to establish communication channels between different processes within a system, enabling them to exchange information or coordinate actions.

Automation and Scripting: System administrators can utilize this module to automate tasks or build scripts that involve communication between different components or programs.

Advantages of using named pipes for inter-process communication include:

Simplicity: Named pipes provide a straightforward and easy-to-use mechanism for communication between processes. They abstract away the complexities of lower-level protocols and offer a simple API for reading from and writing to the pipe.

Efficiency: Named pipes are efficient for communication within a single machine, as they leverage shared memory and kernel-level synchronization. This results in faster data transfer compared to other IPC mechanisms.

Security: Named pipes offer built-in security features, allowing for secure communication between processes. Access to the pipe can be controlled through permissions, ensuring that only authorized processes can read from or write to the pipe.

Overall, the Write2Pipe and ReadFromPipe module simplifies inter-process communication using named pipes, offering an efficient and reliable solution for data exchange and coordination between different components or programs on a Windows system.

  • Write2Pipe: Allows writing messages to a named pipe.
  • ReadFromPipe: Allows reading messages from a named pipe.
# create a file: pipewrite.py
from pywinpipe import Write2Pipe

with Write2Pipe(pipename=r"\\.\pipe\example",
                nMaxInstances=1,
                nOutBufferSize=65536,
                nInBufferSize=65536,
                timeout=0, ) as ba:
    for _ in range(10):
        ba.write_message(b"bababababa" * 2000)


# create another file: piperead.py
from pywinpipe import ReadFromPipe
import numpy as np

with ReadFromPipe(pipename=r"\\.\pipe\example", ) as baba:

    num = np.array([1])
    erx = baba.read_message()
    while len(num)>0:
        try:
            er = next(erx)
            num = np.frombuffer(er[0][:er[1]], dtype='S1')
            print(f'read {er[1]} bytes: {num}')
        except Exception:
            print(er)

# execute pipewrite.py and then piperead.py


# output  pipewrite.py:

# Waiting for clients
# Client connected

# output  piperead.py:

read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']
read 0 bytes: []

Metadata

Release files for pywinpipe 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywinpipe 0.11
File Size Uploaded Provenance Actions
pywinpipe-0.11.tar.gz 5.8 kB Without provenance Details for pywinpipe-0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pywinpipe 0.11
File Interpreter ABI Platform Actions
pywinpipe-0.11-py3-none-any.whl Python 3 none any Details for pywinpipe-0.11-py3-none-any.whl

Total release size: 12.9 kB

Release files / pywinpipe-0.11.tar.gz

Download URL pywinpipe-0.11.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4497248ee4c166fda4af5470769c2bbb95c81754481a4a3758329a6ac0e8ad75
BLAKE2b-256 checksum
How to use checksums
dc6aad775d60cbd810997ad688aca70e8e936e4796e9f97eeeba8df196299b3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / pywinpipe-0.11-py3-none-any.whl

Download URL pywinpipe-0.11-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
056ff0b08f7b26ee77a411e31e8e4c7b8c7c1d29dcbc6a84dbe7dbad363e8e9d
BLAKE2b-256 checksum
How to use checksums
353467b13543a5020710742525dc812c4e7fe401f1ffccbc86da2f7f9c742ef7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for pywinpipe 0.11

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.

Release history Release notifications | RSS feed

This release

0.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page