{"id":17007475,"url":"https://github.com/wkhallen/dtppy","last_synced_at":"2026-02-23T16:04:56.606Z","repository":{"id":65408858,"uuid":"527026019","full_name":"WKHAllen/dtppy","owner":"WKHAllen","description":"Cross-platform networking interfaces for Python.","archived":false,"fork":false,"pushed_at":"2025-03-06T04:14:31.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T05:23:26.039Z","etag":null,"topics":["networking","python","socket","socket-client","socket-server"],"latest_commit_sha":null,"homepage":"https://wkhallen.com/dtp","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WKHAllen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-20T19:53:13.000Z","updated_at":"2025-03-06T04:14:35.000Z","dependencies_parsed_at":"2023-02-12T13:48:09.048Z","dependency_job_id":null,"html_url":"https://github.com/WKHAllen/dtppy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WKHAllen%2Fdtppy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WKHAllen%2Fdtppy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WKHAllen%2Fdtppy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WKHAllen%2Fdtppy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WKHAllen","download_url":"https://codeload.github.com/WKHAllen/dtppy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244952785,"owners_count":20537472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["networking","python","socket","socket-client","socket-server"],"created_at":"2024-10-14T05:25:53.728Z","updated_at":"2026-02-23T16:04:56.578Z","avatar_url":"https://github.com/WKHAllen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Transfer Protocol for Python\n\nCross-platform networking interfaces for Python.\n\n## Data Transfer Protocol\n\nThe Data Transfer Protocol (DTP) is a larger project to make ergonomic network programming available in any language.\nSee the full project [here](https://wkhallen.com/dtp/).\n\n## Installation\n\nInstall the package:\n\n```sh\n$ python -m pip install dtppy\n```\n\n## Creating a server\n\nA server can be built using the `Server` implementation:\n\n```python\nfrom dtppy import Server\n\n\n# Called when data is received from a client\ndef receive(client_id, data):\n    # Send back the length of the string\n    s.send(len(data), client_id)\n\n\n# Called when a client connects\ndef connect(client_id):\n    print(f\"Client with ID {client_id} connected\")\n\n\n# Called when a client disconnects\ndef disconnect(client_id):\n    print(f\"Client with ID {client_id} disconnected\")\n\n\n# Create a server that receives strings and returns the length of each string\ns = Server(on_receive=receive, on_connect=connect, on_disconnect=disconnect)\ns.start(\"127.0.0.1\", 29275)\n```\n\n## Creating a client\n\nA client can be built using the `Client` implementation:\n\n```python\nfrom dtppy import Client\n\nmessage = \"Hello, server!\"\n\n\n# Called when data is received from the server\ndef receive(data):\n    # Validate the response\n    print(f\"Received response from server: {data}\")\n    assert data == len(message)\n\n\n# Called when the client is disconnected from the server\ndef disconnected():\n    print(\"Unexpectedly disconnected from server\")\n\n\n# Create a client that sends a message to the server and receives the length of the message\nc = Client(on_receive=receive, on_disconnected=disconnected)\nc.connect(\"127.0.0.1\", 29275)\n# Send the message to the server\nc.send(message)\n```\n\n## Security\n\nInformation security comes included. Every message sent over a network interface is encrypted with AES-256. Key\nexchanges are performed using a 512-bit RSA key-pair.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkhallen%2Fdtppy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwkhallen%2Fdtppy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkhallen%2Fdtppy/lists"}