mislavmatijevic / barka_chat

C++ low-level implementation of a client-server application I made in October 2020.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

barka_chat

C++ low-level implementation of a client-server application I made in October 2020.

About

Back when I created this solution, I was really into C++. So I played around with POSIX threads and low-level binding to sockets. After fooling around, I ended up with an actual chat client and server which together work perfectly.

User can join a server, identify with a username, discover other active users, pick a user to chat with, get notified when another user joins in or leaves, and leave the server without the server crashing (laugh all you want, but back when I programmed this, the major problem was to not crash the server on any exit by user). The problem was also how to send messages, so there is an entire protocol set up for negotiating and exchanging messages.

Setting up

In order to run the application, you need to be on a Linux system and have the ncurses library ready to be linked. Compile the application with:

g++ -g chat_klijent.cpp -lpthread -lncursesw -o chat_klijent

Given makefile statically links the ncurses library in the output file allowing you to run this piece of cool little software on any Linux system.

In order to compile chat_server, you need a -lpthread flag during compilation.

Screenshots of how does the app look like

Everything in the UI is in Croatian. Back when I did this, I did it for my soul, not to show off to the world.

Entering user's name. entering username

Left: server logging new user's join (Mislav). Right: client's UI. slika

Left: server logging another user's join (Ivan). Upper-right: original user's UI, which states another user has joined. Lower-right: new user's UI, empty two clients UI

Ivan enters '?s' to look at available users. He is given a choice to pick the user he wants to chat with: list of available users

Example of chatting, with a server view as well. It's visible that UTF-8 characters čćšđž are correctly parsed by the server, but Windows CMD I was unfortunately using instead of a normal Linux Terminal failed to display these chars properly in the client app. chit-chat

Example of Ivan leaving the chat gracefully. leaving gracefully

Example of Ivan closing the client process with "kill". leaving with kill

Example of a long chat and an overfill which results in overwritting older messages from the top. lot of messages

Client noticing window too small. window is too small error

About

C++ low-level implementation of a client-server application I made in October 2020.


Languages

Language:C++ 99.5%Language:Makefile 0.5%