DataPath

com.xaymar.datapath

DataPath is an IPC library for fast and predictable messaging between processes on the same machine made in C++11 (or newer). Designed from the ground up to care about the worst case it is able to outperform or match existing solutions such as boost interprocess, libuv, Mojo and others. It allows for packets from a few bytes all the way to many megabytes between one server and any number of clients. The exact implementation varies by platform and makes use of the best measured available systems.

These are the official bindings for DataPath

Features

Python specific Features

Python specific Differences

Usage

pip install com.xaymar.datapath
import datapath

# Server: echo every message.
clients = []
def on_accept(sock):
    clients.append(sock)                               # keep it, or the connection closes
    sock.on_message(lambda data: sock.send(data))      # runs on an I/O thread
    sock.on_close(lambda reason: clients.remove(sock))

server = datapath.host("my-service", on_accept=on_accept)

# Client.
sock = datapath.connect("my-service")
sock.on_message(lambda data: print(data))              # b'hello', twice
sock.send(b"hello")                                    # any bytes-like object
sock.sendv([b"he", b"llo"])                            # one message from several parts, without joining them first
sock.close()
server.close()

API

License

BSD 3-Clause License, see LICENSE.

View this page on GitHub