I want to write a program that allows a number of clients to chat with each other or send files to each other. Also, one client can broadcast a message or a file to other clients.
I have a question about choosing the best data structure for messages.(We have n clients)
So far, I have found these points myself:
- Clients are
circularlinkedlist
- Chat rooms will have a limited number, so they will be an array.
I will have a class as aMessage
in which the clientID, roomID and contents are specified.
Regarding the data structure of the messages, I wanted to use a queue at first, but when the messages increase, I think there will be a problem. In fact, the time complexity increases.
Would you please introduce another data structure as a suggestion? If I made a mistake in the above, I would be grateful if you could tell me.
Thank you in advance for your time