Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Network
»
is "sf::SocketSelector .wait()" required?
Print
Pages: [
1
]
Author
Topic: is "sf::SocketSelector .wait()" required? (Read 5089 times)
0 Members and 1 Guest are viewing this topic.
blue_prawn
Newbie
Posts: 5
is "sf::SocketSelector .wait()" required?
«
on:
October 31, 2019, 10:53:23 pm »
Hi,
I'm new to network programming, and I have a question related to the use of the .wait() method from a sf::SocketSelector object in this example:
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1SocketSelector.php
I read in the documentation that wait() is blocking, so I was wondering if it's possible to not call this function, and call directly .isReady() on my sockets.
Being a beginner with network programming and also with threads/concurrent/asynchrone programming I was wondering if I could start with a single thread and avoid blocking functions like wait()?
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: is "sf::SocketSelector .wait()" required?
«
Reply #1 on:
November 01, 2019, 08:40:13 am »
No, you can't. If you want non-blocking behavior, then put all your sockets in non-blocking mode and just test them separately; the purpose of the SocketSelector is to
block
on a set of sockets, so it's basically useless if you don't want to block
Logged
Laurent Gomila - SFML developer
Print
Pages: [
1
]
SFML community forums
»
Help
»
Network
»
is "sf::SocketSelector .wait()" required?