1
Général / sf::Packet the packet data is mixed up
« le: Décembre 29, 2021, 08:29:33 pm »
Hello, I'm trying to create a thread that takes an instance of the sf::Packet class as an argument, but everything is mixed up there.
sf::UdpSocket sock;
void server(sf::Packet pack, sf::Address addr, sf::Packet packet){
int a;
pack >> a;
std::cout<<a;
}
int main(){
sf::Address addr;
sf::Packet packet;
unsigned short port;
sock.bind(19132);
sock.receive(packet, addr, port);
std::thread thr(server, packet, addr, port);
thr.detach();
}
sf::UdpSocket sock;
void server(sf::Packet pack, sf::Address addr, sf::Packet packet){
int a;
pack >> a;
std::cout<<a;
}
int main(){
sf::Address addr;
sf::Packet packet;
unsigned short port;
sock.bind(19132);
sock.receive(packet, addr, port);
std::thread thr(server, packet, addr, port);
thr.detach();
}