This project implements a mailbox system in C that enables communication between multiple entities via a central server. Senders transmit messages to the server, which stores them in mailboxes associated with receivers. Receivers can then retrieve messages from their mailboxes.
- Sender : Sends messages to the server to be stored in a specific mailbox.
- Receiver : Retrieves messages from a mailbox via the server.
- Server : Manages connections from senders and receivers, and stores messages in mailboxes.
- Mailbox Management : Implementation of a linked list data structure to manage mailboxes and messages.
To clone the project, use the following command:
git clone "https://github.com/AlainPiallat/tsock"To compile the project, use the provided makefile. The generated executable will be named tsock.
- Compile the project:
make
- Clean generated files:
make clean
The tsock executable should be run with the following syntax:
./tsock [MODES] [OPTIONS] [hostname] port-pSink mode (receiving messages)-sSource mode (sending messages)-bServer mode (central mailbox)-e bal_numSender mode (send to mailbox numberbal_num)-r bal_numReceiver mode (read from mailbox numberbal_num)-hDisplay this help message
-uUse UDP protocol (default: TCP)
(used only with -p and -s)-n nb_messageNumber of messages to send or receive (default: 10)
(used with -p, -s, -e, -r)-l len_messageLength of messages (default: 30)
(used with -p, -s, -e)
hostnameServer hostname (required for source, sender, receiver)portListening or connection port
./tsock -p -n 5 -l 40 12345
./tsock -s -n 5 -l 40 localhost 12345
./tsock -b 12345
./tsock -e 2 localhost 12345
./tsock -r 2 localhost 12345Notes:
- Only one mode (
-p,-s,-b,-e,-r) should be specified at a time. - Use
-hto display the full help message.
- Standard C Library:
stdio.h,stdlib.h,string.h, etc. - Socket Library:
sys/socket.h,netinet/in.h,netdb.h.
- Aïman Al-SABAGH-NAHHAS
- Alain PIALLAT
This project is licensed under the Apache License 2.0.
See the LICENSE file for details.