I send a packet like this:
void unencryptedMessage(sf::IpAddress recipient, unsigned short port, characterSprite player) {
sf::Packet packet;
string packetType = "message";
packet << packetType << player << player.message;
if (clientSocket.send(packet, recipient, port) != sf::Socket::Done) {
cout << "Did not send data." << endl;
}
return;
}
I then receive the packet like this:
string packetType;
packet >> packetType;
if (packetType == "message"){
string message;
packet >> playerName >> message;
playerMessages[playerName] = message;
cout << playerName << ": " << message << endl;
}
Let's say the playerName is "Ninjinka" and the message is "Test."
Here is the packet that the server receives:
As you can see, the message doesn't appear to read anything. It only appears to read in the first 27 bytes, whereas the message starts on the 35th byte. Any ideas as to why it's doing this?