An echo server that replicates the request sent by the client and sends it back.
Node.js version 18 or higher https://nodejs.org/en/download
-
Clone the project
% git clone https://github.com/DeKaylaPhillips/Echo-Server
-
Go to the project directory
% cd Echo-Server -
Install dependencies
% npm install
-
Start the server
% npm run dev
The following text should appear in the server terminal after running the previous command which indicates the server has successfully started.
> echo-server@1.0.0 dev > ts-node ./src/server.ts TCP server at http://localhost:3000/.
-
Connect to the server as a client in a separate terminal tab.
- This command should be ran AFTER the server's connection has already been established.
- Note: The Netcat (nc) command for reading and writing data between two computer networks comes pre-installed on MacOS & Linux machines. Windows users may be required to install Netcat or a similar utility.
% nc localhost 3000
The following text should appear in the client terminal after running the previous command which indicates the connection to the server has been established.
Connection established. Please enter a message:
After entering a message and sending it to the server, the following text should appear, indicating that the client connection has been closed:
- Some client message, here - Client connection closed.
-
To manually stop the server, enter the following command within the server terminal.
% CTRL + C