Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
737 B

/*
* Main.cpp
*
* Created on: 07-01-2017
* Author: Piotr Dergun
*/
#include "common.h"
#include "Node.h"
int main(int argc, char *argv[])
{
cout << "Obiekt PC1" << endl;
Node pc1("PC1", "10.0.0.2", "255.0.0.0");
cout << "Obiekt PC2" << endl;
Node pc2("PC2", "10.0.0.3", "255.0.0.0");
cout << "Lacze PC1 z PC2" << endl;
cout << pc1.connectNode(&pc2) << endl;
cout << "Lacze PC1 z PC2 (ponownie)" << endl;
cout << pc1.connectNode(&pc2) << endl;
cout << "Tworze pakiet i adresuje go do PC2" << endl;
Packet p("piekna wiadomosc");
p.setDstIp("10.0.0.3");
p.setDstPort(80);
cout << "Wysylam wiadomosc: ";
cout << pc1.send(p) << endl;
cout << "Wywoluje onRecv() na PC2" << endl;
pc2.onRecv();
return 0;
}