Im sending player ID in packet to client for him players table. Im checking my ID and sending it in Uint16 to client but he dont receive this... or receive a random data ;/ Code:
Server side when client join:
if (type == DOLACZENIE) // client send this when join
{
++IDS;
it->second = IDS;
gracze[IDS].gra = true; // player with ID = IDS is now playing
Packet paccc;
Uint16 cos = IDS;
if (paccc << cos)
{
WyslijPakiet(POLACZONO, paccc); // sending my paccc to client
cout << "CONNECT: " << cos << endl;
}
}
Client receive:
if (type == POLACZONO) // get ID from serwer
{
Uint16 cos;
if (pac >> cos)
{
cout << "ID in connect: " << cos << endl;
packet >> cos;
}
else
{
cout << "error in pac" << endl;
}
}
Output info in console:
CONNECT: 0
error in pac