On 18/03/2018 06:57, Gonzalo Garramuño wrote:
Hi. I want to have a variation on the chat server/client model in that there's a language with instructions being sent.
Both the server and the client need to parse this language. When the server changes something, it sends the change in the language to all clients. When the client changes something it sends the change to the server which in turn resends it to all clients but, here's the catch, not to the one that sent the change in the first place.
When your server receives the change, it knows which client it was received from (since it's received on that client's connection). When you loop through the clients to forward the changes on, simply skip that client instead of sending. (Or send it a confirmation or something instead.) Depending on how your code is structured, this might require you to pass an identifier or pointer from the receiving connection down to the code that forwards the changes, but it should be simple enough.