Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Network
»
Packet::Append
Print
Pages: [
1
]
Author
Topic: Packet::Append (Read 3107 times)
0 Members and 1 Guest are viewing this topic.
troopson
Newbie
Posts: 30
Packet::Append
«
on:
July 21, 2011, 06:22:46 pm »
I got a packet like this:
[sf::Uint8][sf::Uint32][std::string][rest..]
now i want to make a new packet which has only sf::Uint8 and rest. How do i do that using append?(the problem is std::string..)
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Packet::Append
«
Reply #1 on:
July 21, 2011, 06:28:43 pm »
sf::Packet is made for packing data and sending it. You're not supposed to do anything else with it, you should construct it right before sending to the socket with the final data.
What do you need to do that?
Logged
Laurent Gomila - SFML developer
troopson
Newbie
Posts: 30
Packet::Append
«
Reply #2 on:
July 21, 2011, 06:34:56 pm »
I get packet from client [sf::Uint8 type ][sf::Uint32 id ][std::string lobbyname ][rest]
i want to send from server packet without id and lobbyname, only packet type and the rest.
Logged
Nexus
SFML Team
Hero Member
Posts: 6287
Thor Developer
Packet::Append
«
Reply #3 on:
July 21, 2011, 06:39:06 pm »
Construct a new packet with only type and rest, and ignore id and lobbyname?
The overloaded operators << and >> will help you at this task.
Logged
Zloxx II
: action platformer
Thor Library
: particle systems, animations, dot products, ...
SFML Game Development
:
troopson
Newbie
Posts: 30
Packet::Append
«
Reply #4 on:
July 21, 2011, 06:42:24 pm »
yeah dude but all data is IN the packet. to get the rest i need the starting pointer of rest. To do that i need to know what is the size of [sf::Uint8 type ][sf::Uint32 id ][std::string lobbyname ]
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Packet::Append
«
Reply #5 on:
July 21, 2011, 06:46:23 pm »
Extract everything, and send only the variables that you want.
Logged
Laurent Gomila - SFML developer
Print
Pages: [
1
]
SFML community forums
»
Help
»
Network
»
Packet::Append
anything