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

7 years ago
  1. /*
  2. * Main.cpp
  3. *
  4. * Created on: 07-01-2017
  5. * Author: Piotr Dergun
  6. */
  7. #include "common.h"
  8. #include "Node.h"
  9. int main(int argc, char *argv[])
  10. {
  11. cout << "Obiekt PC1" << endl;
  12. Node pc1("PC1", "10.0.0.2", "255.0.0.0");
  13. cout << "Obiekt PC2" << endl;
  14. Node pc2("PC2", "10.0.0.3", "255.0.0.0");
  15. cout << "Lacze PC1 z PC2" << endl;
  16. cout << pc1.connectNode(&pc2) << endl;
  17. cout << "Lacze PC1 z PC2 (ponownie)" << endl;
  18. cout << pc1.connectNode(&pc2) << endl;
  19. cout << "Tworze pakiet i adresuje go do PC2" << endl;
  20. Packet p("piekna wiadomosc");
  21. p.setDstIp("10.0.0.3");
  22. p.setDstPort(80);
  23. cout << "Wysylam wiadomosc: ";
  24. cout << pc1.send(p) << endl;
  25. cout << "Wywoluje onRecv() na PC2" << endl;
  26. pc2.onRecv();
  27. return 0;
  28. }