This repository contains an implementation of an ECHO server for learning purposes, based on RFC 862.
The project implements an ECHO server that listens for client connections and sends back any data received. This is a simple implementation useful for learning about socket programming and network protocols in C.
- Simple ECHO server
- Supports TCP/IP communication
- Implements RFC 862
- make
Clone the repository:
git clone https://github.com/juanpagfe/echo-c.git
cd echo-c
make
# The program will be in the build directory
cd build
Print help to understand the process:
./echo --help
Usage: echo [options]
Options:
-h, --help Show this help message
-p, --port Port the program will use to serve. (Default: 7. Needs superuser permissions in most systems)
Run the program:
./echo -p 8181
Listening on port = 8181
In a different terminal, you can test the server using telnet:
telnet localhost 8181
~ ❯ telnet localhost 8181
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello World!
Hello World!