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

Author Topic: Stopping a socket in blocking mode  (Read 1996 times)

0 Members and 1 Guest are viewing this topic.

LemonLake

  • Newbie
  • *
  • Posts: 1
    • View Profile
Stopping a socket in blocking mode
« on: October 28, 2013, 02:02:18 pm »
I have a UDP socket running on a separate thread for the game server. When the host enters the quit command, it needs to stop the socket from the main thread. How do we do this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Stopping a socket in blocking mode
« Reply #1 on: October 28, 2013, 02:36:38 pm »
SFML provides no way to stop a waiting socket. The best solution is to use a socket selector with a timeout, so that you block only for a certain duration, and can perform periodic termination checks.
Laurent Gomila - SFML developer