- Clone the repo
- Run the following command in the directory to compile
make all
- the Makefile will generate aserver
andclient
executable
- Open two separate terminals and run
server
in the first open - Once the server is running, run
client
in the other Once - Play around and enjoy!
- A remote shell used for simulate core concepts of OS system calls
- server.cpp runs a process which listens on
localhost:5001
- client.cpp runs a process to look for that socket address
- If the server is there and accepting, create a new socket connection
- The connection stays open indefinitely, until the client inputs
exit
- The client reads input line by line from
stdin
- The client sends this data to the server, the server handles the processing
- The server makes a pipe system call to create a child process and execute the input
- The exec System call is looking to execute a bash command and store it in variable
- Finally, the server will send back the contents of the output to the client
- The client renders the output, and continues to sit on the connection