Cross-platform networking interfaces for Python.
Project description
Data Transfer Protocol for Python
Cross-platform networking interfaces for Python.
Data Transfer Protocol
The Data Transfer Protocol (DTP) is a larger project to make ergonomic network programming available in any language. See the full project here.
Installation
Install the package:
$ python -m pip install dtppy
Creating a server
A server can be built using the Server implementation:
from dtppy import Server
# Called when data is received from a client
def receive(client_id, data):
# Send back the length of the string
s.send(len(data), client_id)
# Called when a client connects
def connect(client_id):
print(f"Client with ID {client_id} connected")
# Called when a client disconnects
def disconnect(client_id):
print(f"Client with ID {client_id} disconnected")
# Create a server that receives strings and returns the length of each string
s = Server(on_receive=receive, on_connect=connect, on_disconnect=disconnect)
s.start("127.0.0.1", 29275)
Creating a client
A client can be built using the Client implementation:
from dtppy import Client
message = "Hello, server!"
# Called when data is received from the server
def receive(data):
# Validate the response
print(f"Received response from server: {data}")
assert data == len(message)
# Called when the client is disconnected from the server
def disconnected():
print("Unexpectedly disconnected from server")
# Create a client that sends a message to the server and receives the length of the message
c = Client(on_receive=receive, on_disconnected=disconnected)
# Send the message to the server
c.send(message)
Security
Information security comes included. Every message sent over a network interface is encrypted with AES-256. Key exchanges are performed using a 512-bit RSA key-pair.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dtppy-0.1.1.tar.gz.
File metadata
- Download URL: dtppy-0.1.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13672af62957d69eb5ade4a280fc46a985ac93a6588e9b6c1e97ae133b4aeb66
|
|
| MD5 |
d10b938247a4b5c96677a0e1d705f9b7
|
|
| BLAKE2b-256 |
136b066a0cabedfb7155f2ac500084f6f0847519be33fc2e5e9424b159bfae87
|
File details
Details for the file dtppy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dtppy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3107f2fb8c66c2cddce092e26584f356a9d1327ccd3cabfd0bb49abe85b0c78f
|
|
| MD5 |
d4efde5e385a8e2f867d97b2a78b8073
|
|
| BLAKE2b-256 |
7a41df368c229394dda98de898264f836663b8d11739af0c166912594d28dfe9
|