How to Compile and Run the SmallChat C Server from GitHub

This guide shows how to clone the SmallChat repository, compile the C source with gcc, launch the server binary, and connect via telnet to test the default 7771 port, including code snippets and command‑line examples.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Compile and Run the SmallChat C Server from GitHub

Repository

Source code: https://github.com/antirez/smallchat

git clone [email protected]:Tinywan/smallchat.git

Compilation

Compile the single source file with gcc:

cd smallchat/
gcc -o smallchat smallchat.c
The -o option sets the output file name ( smallchat ); smallchat.c is the source file.
ls
Makefile  README.md  smallchat  smallchat.c

Running the Server

./smallchat

The server listens on port 7771 by default. To change the port, edit the constant #define SERVER_PORT 7711 in the source code and recompile.

Connecting with Telnet

telnet 127.0.0.1 7711

After connecting, set a nickname with /nick <nick> and start sending messages.

Terminal 1

telnet 127.0.0.1 7711
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Welcome to Simple Chat! Use /nick <nick> to set your nick.
/nick tinywan001
This is just a programming example (tinywan001)

Terminal 2

telnet 127.0.0.1 7711
... (connection steps) ...
/nick tinywan002
Since I wrote this little program (tinywan002)

Server Output

./smallchat
Connected client fd=4
Connected client fd=5
tinywan002> Since I wrote this little program (tinywan002)
tinywan001> This is just a programming example (tinywan001)
... (message exchange) ...
Disconnected client fd=5, nick=tinywan002
Disconnected client fd=4, nick=tinywan001

Telnet Command Overview

Basic syntax: telnet ip_address port Replace ip_address with the target host and port with the service port (e.g., 7711).

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendCgcctelnetsmallchat
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.