|
|
@ -176,8 +176,10 @@ void Simulation::p2pSimulation() |
|
|
|
this->print("Creating P2P peers"); |
|
|
|
Peer peer1("Peer 1", "192.168.1.2", "255.255.255.0", "192.168.1.1"); |
|
|
|
peer1.setSender(true); |
|
|
|
peer1.setSim(this); |
|
|
|
peer1.setLogParams(0, GREEN, "\t\t"); |
|
|
|
Peer peer2("Peer 2", "10.0.0.2", "255.255.255.0", "10.0.0.1"); |
|
|
|
peer2.setSim(this); |
|
|
|
peer2.setLogParams(4, CYAN, "\t\t"); |
|
|
|
peer1.print("IP 192.168.1.2/24, Gateway: 192.168.1.1"); |
|
|
|
peer2.print("IP 10.0.0.2/24, Gateway: 10.0.0.1"); |
|
|
@ -203,6 +205,7 @@ void Simulation::p2pSimulation() |
|
|
|
|
|
|
|
this->print("Creating P2P server"); |
|
|
|
P2PServer server("Server", "80.80.90.91", "255.255.255.255"); |
|
|
|
server.setSim(this); |
|
|
|
server.setLogParams(2, YELLOW, "\t\t"); |
|
|
|
server.print("IP 80.80.90.91/32"); |
|
|
|
sleep(1); |
|
|
@ -230,6 +233,7 @@ void Simulation::p2pSimulation() |
|
|
|
this->createThread("r2", NODE_RECV, &r2); |
|
|
|
this->createThread("s1", NODE_RECV, &server); |
|
|
|
|
|
|
|
this->print("Connecting peers to P2P server"); |
|
|
|
peer1.connectToServer("80.80.90.91", 6565); |
|
|
|
peer2.connectToServer("80.80.90.91", 6565); |
|
|
|
sleep(1); |
|
|
|