SFML community forums

Help => Network => Topic started by: Trident_Tail on December 06, 2014, 01:23:49 am

Title: TCP Client/Server Code - one client running much slower than the other
Post by: Trident_Tail on December 06, 2014, 01:23:49 am
I've been writing a simple TCP Client/Server game and while both clients can send/recieve data, the first client will always run at around half the FPS as the other. Here is the code:

Client update function that is ran each frame
(click to show/hide)

And the server update function that is ran each frame also:
(click to show/hide)

Can you see any problems with this? Thanks!

EDIT: I should say that both the client and server sockets are set too non-blocking.
Title: Re: TCP Client/Server Code - one client running much slower than the other
Post by: eXpl0it3r on December 06, 2014, 02:41:15 am
Start your debugger and profiler and figure out what's going on. It's so much easier for you to figure out, than for us who can't directly test the code, due to a missing complete and minimal example and the fact that we haven't written the code, thus have no idea what's going on.

If you use non-blocking sockets, you most likely want to use some selector. I suggest you read through the networking section (https://github.com/SFML/SFML/wiki/FAQ#network) of the FAQ.