Skip to content

petr-plihal/chat-client-ipk25

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Client application for chat server

language misc

Description

Client application for communicating with a chat server using a custom IPK25-CHAT protocol. The project implements the TCP variant of the protocol, handling connection setup, authentication, joining channels, sending and receiving messages, and graceful termination. The design anticipates extension to the UDP variant. The implementation uses object-oriented design and state/strategy design patterns.

Technical Documentation is in form of markdown in doc/ directory.


Usage

Dependencies and prerequisites

  • Linux (or WSL/Unix-like environment)
  • g++ (with C++20 support)
  • make

Setup

  1. Clone the repository
git clone git@github.com:petr-plihal/chat-client-ipk25.git
cd chat-client-ipk25
  1. Build the project
make

NOTE: The Makefile is set to compile the program without -DDEBUG_PRINT flag. The flag can be added, in case you want to know how the program roughly operates. To turn this on, simply add the -DDEBUG_PRINT to the flags in Makefile on line 5.

Executing program with local example server

If no server is setup for connection, you can run simple dummy python server script, or use the nc command to simulate chat server. All the Python server does is respond to your messages and commands with acknowledgements. Plus it repeats any messages sent.

Example usage with Python dummy server

First run the server in one terminal:

python3 ./test/simple_server.py

In another terminal, run application with:

./ipk25chat-client -t tcp -s 127.0.0.1

NOTE: To see what the arguments mean, you can see help:

./ipk25chat-client -h

In the client application, to see what commands are available for interaction with the program, type /help.

The general user-flow might be as follows:

  1. Authenticate with the server using username, secret, display name.
/auth username secret display_name
  1. Join different channels (by default you are joined into general channel).
/join different_channel
  1. Send message into current channel.
Simply write the message without any "\", the server will just send it back.
  1. To correctly terminate the connection, use CTRL+C, the server will shut down too.

Alternatively, you can use nc command to receive client messages as text, and respond by manually typing the responses. To start listening:

nc -4 -C -l -p 4567

See the assignment or documentation for more usage examples.


License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

About

Client application for chat server.

Topics

Resources

License

Stars

Watchers

Forks