0

I have been looking at a lot of Boost.Asio tutorials, especially this one: TCP daytime server

After a server creates a tcp_connection with a client, it seems like the communication is only one-way between the server and that specific client. How can I make it so a server has the ability to relay client messages to all of the clients connected? Or even choose which clients to send messages to.

Joey Weidman
  • 373
  • 2
  • 4
  • 9

1 Answers1

0

TCP create only connexion between the server and a specific client. You can use UDP connexion to broadcast message to several clients.

Like JTejedor says in comments, you can also create a TCP socket for each client.

baddger964
  • 1,199
  • 9
  • 18
  • You can use UDP broadcast. Here is a question related to how create UDP broadcast using Boost [UDP broadcasting](http://stackoverflow.com/questions/9310231/boostasio-udp-broadcasting). But if you prefer use TCP, you need to create a connection with each client and send any message to each client explicity. – JTejedor Apr 24 '17 at 07:50