This implementation is able to create multiple clients which connect to one server and integrate with him.
- When a client connects to the server, sends the LOG_ON <IP address, portNum> message to him, so as to inform for its existence.
- The the server sends to all the connected clients the needed details of the new client. Both the server and the already connected clients keep the details of the new client to a list.
- A client can request a list of all the connected clients to the server via the GET_CLIENTS command. When the server receives this commands, it forwards the list to all the connected clients.
- When a client disconnects it sends the LOG_OFF <IP, port> message to the server. The server updates its clients list and then inform the connected clients in order to update their list too.
The service is based on three C libraries:
- sys_socket.h sys/socket.h — main sockets header.
- netdb.h netdb.h — definitions for network database operations.
- pthread.h pthread.h — threads.
In order to be able to run this implementation you will need at least one linux machine or multiple with access to the same network.
- Change clientPort, workersNumber, bufferSize, serverPort, serverIP with the details for your clients.
- Change serverPort with the details for your server.
- After finishing your configurations
- Navigate to the server's folder and run the following command:
make clean valgrind
- Then navigate to the client's folder and run the following command:
make clean valgrind
. If you wish more than one clients you should reconfigure the client's Makefile before each run.