I have tried to make connection between several nodes in my private network, but I do it with a enode direction, but Ethereum network does it without knowing my enode, I want to know what kind of p2p communication protocols used, so that all nodes are communicate with each other, and if that code is free.
How does it the geth ethereum platform to automatically connect to the nodes that are in the main network of Ethereum?
The Ethereum Foundation runs bootnodes and the clients have the enode URIs hardcoded into the clients. These nodes are used for initial discovery and are generally disconnected from once someone has enough nodes. You can read more about the general wire protocol, called DEVp2p here.