/tcp-server

A single-threaded TCP server with an event loop using the poll system call written in C.

Primary LanguageC

TCP Server in C

This is a basic single-threaded TCP server with an event loop using the poll system call, written in C, without any third-party library. The server listens on a port and echoes back received data. I've also written a simple client to test the server.

For details on the resources utilized in this project, please refer to the section provided below.

How to run

  1. Clone the repository

  2. Compile client and server programs (don't worry, there's a Makefile to do this for you)

    make
  3. Run the server (it will run on port 3001)

    ./bin/server
  4. Run the client in another terminal

    ./bin/client
  5. Type something in the client terminal and press enter. You should see the server echoing back what you typed.

  6. Ctrl+C to stop the server and client.

Resources