pywinpipe


Namepywinpipe JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/pywinpipe
Summarypywinpipe - Fast data exchange between 2 processes (Windows only)
upload_time2023-05-24 00:37:08
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords pipes windows named pipes share data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.


```python
# 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: []
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/pywinpipe",
    "name": "pywinpipe",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pipes,windows,named pipes,share,data",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dc/6a/ad775d60cbd810997ad688aca70e8e936e4796e9f97eeeba8df196299b3c/pywinpipe-0.11.tar.gz",
    "platform": null,
    "description": "# pywinpipe - Fast data exchange between 2 processes (Windows only)\r\n\r\n## pip install pywinpipe\r\n\r\nThe pywinpipe module with the 2 classes: Write2Pipe and ReadFromPipe can be beneficial for people who need to establish \r\ninter-process communication (IPC) between different programs or components on a Windows system.\r\n\r\nBy utilizing named pipes, this module enables communication through a simple and efficient mechanism.\r\nSome potential beneficiaries of this module include:\r\n\r\nClient-Server Applications: The module allows for communication between a client and a server process, facilitating \r\ndata exchange and coordination between the two.\r\n\r\nInter-Process Communication: Developers can use this module to establish communication channels between different \r\nprocesses within a system, enabling them to exchange information or coordinate actions.\r\n\r\nAutomation and Scripting: System administrators can utilize this module to automate tasks or build scripts that \r\ninvolve communication between different components or programs.\r\n\r\nAdvantages of using named pipes for inter-process communication include:\r\n\r\nSimplicity: Named pipes provide a straightforward and easy-to-use mechanism for communication between processes. \r\nThey abstract away the complexities of lower-level protocols and offer a simple API \r\nfor reading from and writing to the pipe.\r\n\r\nEfficiency: Named pipes are efficient for communication within a single machine, as they leverage shared memory \r\nand kernel-level synchronization. This results in faster data transfer compared to other IPC mechanisms.\r\n\r\nSecurity: Named pipes offer built-in security features, allowing for secure communication between \r\nprocesses. Access to the pipe can be controlled through permissions, ensuring that only \r\nauthorized processes can read from or write to the pipe.\r\n\r\nOverall, the Write2Pipe and ReadFromPipe module simplifies inter-process communication using named pipes, \r\noffering an efficient and reliable solution for data exchange and coordination between \r\ndifferent components or programs on a Windows system.\r\n\r\n\r\n- Write2Pipe: Allows writing messages to a named pipe.\r\n- ReadFromPipe: Allows reading messages from a named pipe.\r\n\r\n\r\n```python\r\n# create a file: pipewrite.py\r\nfrom pywinpipe import Write2Pipe\r\n\r\nwith Write2Pipe(pipename=r\"\\\\.\\pipe\\example\",\r\n                nMaxInstances=1,\r\n                nOutBufferSize=65536,\r\n                nInBufferSize=65536,\r\n                timeout=0, ) as ba:\r\n    for _ in range(10):\r\n        ba.write_message(b\"bababababa\" * 2000)\r\n\r\n\r\n# create another file: piperead.py\r\nfrom pywinpipe import ReadFromPipe\r\nimport numpy as np\r\n\r\nwith ReadFromPipe(pipename=r\"\\\\.\\pipe\\example\", ) as baba:\r\n\r\n    num = np.array([1])\r\n    erx = baba.read_message()\r\n    while len(num)>0:\r\n        try:\r\n            er = next(erx)\r\n            num = np.frombuffer(er[0][:er[1]], dtype='S1')\r\n            print(f'read {er[1]} bytes: {num}')\r\n        except Exception:\r\n            print(er)\r\n\r\n# execute pipewrite.py and then piperead.py\r\n\r\n\r\n# output  pipewrite.py:\r\n\r\n# Waiting for clients\r\n# Client connected\r\n\r\n# output  piperead.py:\r\n\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 20000 bytes: [b'b' b'a' b'b' ... b'a' b'b' b'a']\r\nread 0 bytes: []\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "pywinpipe - Fast data exchange between 2 processes (Windows only)",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/pywinpipe"
    },
    "split_keywords": [
        "pipes",
        "windows",
        "named pipes",
        "share",
        "data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "353467b13543a5020710742525dc812c4e7fe401f1ffccbc86da2f7f9c742ef7",
                "md5": "4df5921a734dd1a83a5acafa80ab7eed",
                "sha256": "056ff0b08f7b26ee77a411e31e8e4c7b8c7c1d29dcbc6a84dbe7dbad363e8e9d"
            },
            "downloads": -1,
            "filename": "pywinpipe-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4df5921a734dd1a83a5acafa80ab7eed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7142,
            "upload_time": "2023-05-24T00:37:05",
            "upload_time_iso_8601": "2023-05-24T00:37:05.642935Z",
            "url": "https://files.pythonhosted.org/packages/35/34/67b13543a5020710742525dc812c4e7fe401f1ffccbc86da2f7f9c742ef7/pywinpipe-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc6aad775d60cbd810997ad688aca70e8e936e4796e9f97eeeba8df196299b3c",
                "md5": "924beb9d7092597034a7baa2612decfe",
                "sha256": "4497248ee4c166fda4af5470769c2bbb95c81754481a4a3758329a6ac0e8ad75"
            },
            "downloads": -1,
            "filename": "pywinpipe-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "924beb9d7092597034a7baa2612decfe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5769,
            "upload_time": "2023-05-24T00:37:08",
            "upload_time_iso_8601": "2023-05-24T00:37:08.025861Z",
            "url": "https://files.pythonhosted.org/packages/dc/6a/ad775d60cbd810997ad688aca70e8e936e4796e9f97eeeba8df196299b3c/pywinpipe-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-24 00:37:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "pywinpipe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pywinpipe"
}
        
Elapsed time: 0.09367s