I need to make peer-to-peer communication between applications.
The applications also shall find each other automatically in internet. For this, among other things, I need to overcome NAT Traversal
, etc.
As example, I need to use the communication something like following:
InternetPeer peer;
peer.setName("my_name");
peer.listen(); // accept connections
peer.startSearchForOthers(); // find another peers
connect(&peer, &InternetPeer::newConnection, this, ...);
connect(&peer, &InternetPeer::anotherPeerFound, this, ...);
QStringList peerNames = peer.availablePeers();
peer.sendMessage(peerNames.at(0), "Hello");
peer.close();
Then it would be good to have some way to access such a connection with QTcpSocket
or QUdpSocket
.
How this can be done on Qt and c++?