Say I have 5 clients that I want to send the same game 'snapshot' to, but I want them to have unique headers. I don't want to have to re-build the packet between each send, but I can't think of any way to do this without re-building the packet from scratch between each socket.send(packet, connection[j].ip, connection[j].port).
If my question still isn't clear here is an example:
Msg for client 1:
12
6
4
5
7
Msg for client 2:
18
3
4
5
7
Msg for client 3:
15
1
4
5
7
Msg for client 4:
0
0
4
5
7
Msg for client 5:
3
5
4
5
7
Each client is getting the same bottom 3 numbers, but they have unique numbers in the top two. What I am doing now is building the packet for c1, sending to c1, clear packet, build packet for c2, send to c2, clear, build packet for c3, etc.
This seems like a waste.
I could make do with moving the 'unique' fields to the bottom of the packet if that's the only way. Maybe I could do this by sending the shared version of the packet to a function with func(sf::Packet packet) signature forcing a copy?
Thanks.