Disclaimer: This scenario is for educational purposes only and does not represent recommended practices.
Imagine a hypothetical situation where two devices on a physically isolated network need to exchange data. This project could explore techniques for establishing communication within such a controlled environment, highlighting the potential security considerations and limitations.
Key Points:
- Communication within a closed network (not connected to the internet).
- Focus on understanding message transmission mechanisms.
- Importance of responsible use and potential security risks.
Linux or Unix (MacOs) based operating system.
(and on Windows system you might find difficult you have to import winsock2.h , ws2tcpip.h and windows.h blah blah blah...)
Clone this repository
Open terminal
cd ClosedNetComm/'Source File'
./script.sh
This script will copy the code inside to the 'Source File' to the directory where the C++ header file is present
code for server
#include <server.h>
int main(){
char ip[]="127.0.0.1";
int port =7777;
// server( ip_address, portNumber, logging ( 1 for enable/ 0 for disable)
server(ip, port, 1);
}
code for client
#include <client.h>
int main(){
char ip[]="127.0.0.1";
int port =7777;
client(ip, port);
}
CAUTION while using this code select port number above 1024 cause below 1024 are reserved by the operating system for the system services
g++ yourFileName.cpp -o outpuFileName -std=c++20 -pthread && ./outputFileName
here's breakdown of above terminal command :
g++ :- telling terminal to compile for c++ file the <yourFileName.cpp> this the directory of the cpp file < -o yourFileName > and output it in a yourFileName file and < -std=c++20 > we're stating compiler to use c++20 (you can use 11 -upper) and -pthread to include this while compiling cause this file is multithreaded and execute ./yourFileName