Skip to main content

Super P2P library

Project description

SP2PPY

API

Server

SP2P (Super Peer-to-Peer) Relay Server

Responsibilities:

  • Accepts TCP connections from clients.
  • Assigns unique 8-character hex addresses to clients.
  • Allows clients to connect to each other via the CONN <ADDRESS> command.
  • Relays data between paired clients.

SP2P Protocol:

  • On connect: YOURADDR <ADDRESS> is sent to the client.
  • To connect to a peer: send CONN <TARGET_ADDRESS>.
  • On success: connecting client receives OK, the target peer receives CONNED <ADDRESS>.
  • All relayed messages: <SENDER_ADDRESS>: <DATA>.
  • On disconnect initiated by a peer: the other side receives DISCONN.

Client

SP2P (Super Peer-to-Peer) TCP Client

Responsibilities:

  • Connects to an SP2P Server and receives its unique address.
  • Sends CONN <ADDRESS> to initiate a connection to another peer.
  • Handles incoming commands and packets:
    • YOURADDR <ADDR>: own assigned address
    • OK: connection to peer successful
    • CONNED <ADDR>: peer has connected to you
    • DISCONN: peer has disconnected
    • <ADDR>: <DATA>: message relayed from peer

Hooks (override in subclass or override instance methods):

  • on_ready(address): Called with own address after connecting to server.
  • on_connected(): Called after successful connection to peer.
  • on_peer_connected(peer_address): Called when a peer connects to you.
  • on_disconnected(): Called when the peer disconnects.
  • on_message(sender_address, message): Called on incoming message.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sp2ppy-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sp2ppy-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file sp2ppy-1.0.0.tar.gz.

File metadata

  • Download URL: sp2ppy-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for sp2ppy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ed48cf15932ddeeefd04028d06237456acbf68b29799d7aab65c7118f3864c52
MD5 f8311649d7279903d9498e439e55189e
BLAKE2b-256 6202ded9baf4b50fd5c0c287922ff4cece2a92b750b9f7ff4de8a5f2c77af8a5

See more details on using hashes here.

File details

Details for the file sp2ppy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sp2ppy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for sp2ppy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b1381f7f900b8a01e50ae217d8eb2429d700b5a4a8966c7011910693a917f49
MD5 3499a635cc75698aef06d2f77a7055b0
BLAKE2b-256 50a87193b9e92bbdc89fc3acd45a4e2613971bae57308169fe490b0186acc22f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page