Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: TCP Client/Server Code - one client running much slower than the other  (Read 1692 times)

0 Members and 1 Guest are viewing this topic.

Trident_Tail

  • Newbie
  • *
  • Posts: 1
    • View Profile
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.
« Last Edit: December 06, 2014, 01:26:36 am by Trident_Tail »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: TCP Client/Server Code - one client running much slower than the other
« Reply #1 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 of the FAQ.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything