I wanted to get into network programming, so I decided to make a texting system. To make it more interesting, I decided to make it from scratch.
I picked C++ because I am most familiar with it. It is low-level enough to allow more control over the system, but high-level enough to allow abstraction without too much hassle.
This project only relies on the POSIX C library. No external libraries are used. It is portable to any POSIX-compliant system (e.g. Linux, macOS, BSD, etc.). The POSIX C library is wrapped in a C++ interface.
Here is the demonstration on YouTube.
- Multiple clients can send messages to each other
- Non-blocking I/O
- C++20 (GNU GCC 12.1.0)
- CMake (version 3.22 or above)
- A POSIX-compliant system (e.g. Linux, macOS, BSD, etc.)
- Clone this repository
cmake -S. -Bbuild
make -Cbuild
- The executables
jaltext_server
andjaltext_client
in the directorybuild/
will appear.
- If you can’t build the project, please make sure the dependencies are correctly applied;
- You can use the
-j
flag for Make to enable multithreaded compiling (for example, my laptop has 4 cores, so I usually runmake -Cbuild -j4
).
src/
: Source code of the project implementationjalsock/
: The wrapped standalone POSIX C library functions (e.g.send()
,recv()
, etc.)types/
: The wrapper classes for the POSIX C library (e.g.addr_info
,sockaddr
, etc.)server/
: The server implementationclient/
: The client implementation
- I could have done better with
epoll
, but I decided to useselect
because it is easier to use. I will probably switch toepoll
in the future.
This project is licensed under the GNU Affero General Public License v3.0.