1
Network / Receiving data
« on: December 18, 2017, 06:07:04 pm »
I'm trying to learn sfml network, but there are so few example, and even if I find some, those are wrong or just weird.
For example, this code:
https://github.com/SFML/SFML/wiki/Source:-Network-Chat-Example
seems okay, but in the DoStuff thread, the
Why is that?
Can someone give me a good source code for client-server game program? (I don't mind if it complex)
I think I already know the basics theory, but that would be great, if someone share with me a good free article, book or video about sfml network.
I hope it's something obvious thing (just not for me )
For example, this code:
https://github.com/SFML/SFML/wiki/Source:-Network-Chat-Example
seems okay, but in the DoStuff thread, the
Code: [Select]
sf::Packet packetSend;
globalMutex.lock();
packetSend << msgSend;
globalMutex.unlock();
socket.send(packetSend);
part constantly sending(spamming) data and it's eats a ton of processing power, however if I delete that part, then the socket.receive(packetReceive); simply won't run, even if I send data, from another client.Why is that?
Can someone give me a good source code for client-server game program? (I don't mind if it complex)
I think I already know the basics theory, but that would be great, if someone share with me a good free article, book or video about sfml network.
I hope it's something obvious thing (just not for me )