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

Author Topic: UDP packet returns 0 after unpacketing  (Read 1748 times)

0 Members and 1 Guest are viewing this topic.

genfy

  • Newbie
  • *
  • Posts: 2
    • View Profile
UDP packet returns 0 after unpacketing
« on: February 21, 2017, 01:27:09 am »
std::cout << "Sending the player id: " << c.id << std::endl; //prints 1
packet << ugid << pt::handshake << id;
socket.send(packet, sender, rport);
packet >> c.id >> c.id >> id;
std::cout << id << std::endl; //prints 0

I'm handing my client a unique ID which increments every connect. This is for my first client, the id variable is 1 and I pass it to my packet, but when opening the packet the id variable is 0. I'm using sf::UInt32. I'm opening the packet on the server side, but it is 0 on the client side too.

pt::handshake is an enum = 0.

Here are the links to my full server code:
http://pastebin.com/eChQu6fd
http://pastebin.com/yMTLeHeV

 

anything