This project is a chat system in C++ that uses sockets for communication between the server and clients.
To compile the project, run the command:
$ make all
Then, you need to start the server program and run separate programs for each client:
$ ./server
Next, start the program for each required client:
$ ./client
$ ./client
$ ./client
...
src/server.cpp: Server implementation.src/server.hpp: Headers and definitions used by the server.src/client.cpp: Client implementation.src/client.hpp: Headers and definitions used by the client.
-
This project uses ANSI escape codes to customize terminal output with colors and styles. There is a variable
style = 1inserver.hpp. To disable styles, set this variable to0. -
This project employs multithreading to manage connections with multiple clients, supporting up to 8 clients by default. To increase the number of clients, you need to modify the
MAX_CLIENTSconstant inserver.hppand adapt the rest of the code accordingly. -
The messages and comments used are in Portuguese/BR
-
Private chat functionality is implemented with a command mechanism for messages. Clients can use the following four commands:
\a message : Sends a global anonymous message
\p user : Initiates a private chat with the user
\w user mensagem : Sends a whisper to the user
\exit : Exits the chat
