townsend wrote:Excellent definition of UDP Hole Punching!! Now-- as for "discovering peers," This is NOT necessary. What is necessary is being able to accept a connection from an anonymous client. Then depending on the initial packet received, the receiving client app, could decide whether to disconnect OR exchange data.
I have little experience with UDP, since I've been able to do what I need with TCP, and given Dr. Raney's comments about UDP's unreliability and unpredictable data size limits:
http://lists.runrev.com/pipermail/metac ... 01537.html
However, most of what I need to do has been client-server, with the little experience I've had in P2P being limited to LANs, mostly for managing appliances and task-sharing systems where we very much
don't want them available from the outside.
That said, It seems most routers ship with port forwarding features, and many provide defaults for a wide range of apps from popular games to iTunes and more, suggesting it's not an uncommon method for allowing external connections to reach internal machines.
LC's chat example stacks use port 1987, and making an entry in my router to forward that port to the internal address of the machine running that stack allows me to connect easily from the outside.
It would certainly be more convenient to the end-user if we could avoid having to require them to allow forwarding the relevant port in their router settings, but given the apparent number of apps that ask this of users it doesn't appear too onerous.
Hopefully we'll see the ability to specify an internal port added to the engine soon, and now that the engine's source code is open it could be added by any interested community member at any time.
But in the meantime, it seems the workarounds available can at least allow the connection to be established, so we can move on to the bigger challenges:
It may be worth considering that even Apache, which is not only fully threaded but also presumes it's running on a machine dedicated as a server, ships with a default setting for MaxClients of just 150. The overhead of socket connections, whether handled in spawned threads or spawned processes, may pose an issue on some systems if each client attempts to connect to all other clients.
It's been long time since I looked at the Gnutella protocol (in my youth I was ambitious enough to attempt an LC library for that, long since abandoned because existing Gnutella clients were pretty good), but IIRC each client has relatively few open connections to other clients, with the Gnutella network as a whole running by chaining small clusters of connected devices to other small clusters.
I think you hit the nail on the head here:
I think some sort of basic protocol would needed for all the common and essential operations. Ideally it would be in such a structure that other commands and operations could easily be added to the same structure, by each developer, depending on the needs of their p2p network.
Would an existing protocol do what you want to do? If an existing protocol could be used we'd be able to avoid replicating the lengthy design effort, and would have the additional benefit of being interoperable with other systems.