P2PConnect is meant to facilitate true serverless peer to peer networking. This is an early stage project. Initial peer discovery is initiated as the client randomly selects one port of a fixed collection to be the designated broadcast port, while listening on all the others. The pool of ports are the same for all clients, so as they begin to broadcast to the LAN they will at some point reach each other. Multicast is also utilized if available to the network. The clients are broadcasting a unique identifier that tells the reciever [1] Whether or not the packet came from a trusted source [2] How to connect to the sender, which the receiver can use to then establish a reliable TCP connection. Once a TCP connection is esablished, they begin to communicate with eachother. Currently, 2 reliable peer "pings" elevates the peer's status to begin data transmisssion (distributed memory, files, ect). The current sample attempts to load "RandomeFile.csv" and broadcast it (this is temporary debugging during the development phase). Down the road the DistributionHandler will be used to store data and process a task queue among network members, and the EncryptionHandler will manage unique signatures and data integrity.
Note: If you are on a LAN with two machines and they both startup on the same broadcast port within a minute of eachother, there can be hangups that lead to hindered discovery.
Note: Generally, with enough time, LAN peers will establish reliable communication and ping each other. There are some instances such as the scenario above where there's a rare exception.
Note: DistributionHandler is still in early development and is mostly just scaffolding for now.
Roadmap:
- Short term implementation to improve reliability and stability of peer connections:
[1] Rotating broadcast port [2] Discern excess local connection and trim them [3] Variabalize rate of broadcasting as to a sine wave rather than constant heart beat to lighten computation load
- Full implementation of duty packets (CollectionSharePacket and DisconnectPacket) to enchance peer discovery and connection integrity.
- Medium term finalization of DistributionHandler to faciliate data transmission among peers.
- Medium term implementation of an encryption handler that will integrate cryptographic keys to encrypt outgoing and decrypt incoming network broadcasts.
- Long term implementation of WAN discovery mechanism(s).