Forum de la communauté SFML

Aide => Général => Discussion démarrée par: s1and1 le Décembre 29, 2021, 08:29:33 pm

Titre: sf::Packet the packet data is mixed up
Posté par: s1and1 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();
}
Titre: Re: sf::Packet the packet data is mixed up
Posté par: G. le Décembre 29, 2021, 08:42:13 pm
French forums again.

>>> (https://en.sfml-dev.org/forums/Themes/ds-natural_20/images/custom/en-icon.png) english (https://en.sfml-dev.org/forums/) (https://en.sfml-dev.org/forums/Themes/ds-natural_20/images/custom/en-icon.png) <<<