Hi. I have to write a communicator. I have an idea of server implementation, but I don't know is it good.
1. Clients 1 and 2 connects to a server.
Server stores IDs of each (ex. '1', '2') in global vector IDs table and stores each socket descriptor in global vector fd table.
2. Client 1 send message to Client 2.
Client 1 sending struct: int SenderID, int ReceiverID, char[size] msg; Server searching in global vector table for ReceiverID and if it finds, it sends struct to appropriate socket descriptor from global vector fd table.
3. Server will call close(sock) only if client request for it.
Now please tell me is this solution is good or not. I'm a beginner and maybe there is different, better solution. And of course sorry for my english...