Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - spacebasics

Pages: [1]
1
Okay thank you. It seems as though my best bet is to build the shared portion of the packet first then pass that into a function as value (not reference) so it's copied and then in that function add the unique pieces before sending it. This results in part of the 'header' being at the end of the packet, but has the functionality I was looking for.

2
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.

Pages: [1]