CSFML 3.0.0
Loading...
Searching...
No Matches
SocketSelector.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <CSFML/Network/Export.h>
31
32#include <CSFML/Network/Types.h>
33#include <CSFML/System/Time.h>
34
35
42 CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_create(void);
43
52 CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector);
53
60 CSFML_NETWORK_API void sfSocketSelector_destroy(const sfSocketSelector* selector);
61
73 CSFML_NETWORK_API void sfSocketSelector_addTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
74 CSFML_NETWORK_API void sfSocketSelector_addTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
75 CSFML_NETWORK_API void sfSocketSelector_addUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
76
87 CSFML_NETWORK_API void sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
88 CSFML_NETWORK_API void sfSocketSelector_removeTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
89 CSFML_NETWORK_API void sfSocketSelector_removeUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
90
101 CSFML_NETWORK_API void sfSocketSelector_clear(sfSocketSelector* selector);
102
118 CSFML_NETWORK_API bool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout);
119
136 CSFML_NETWORK_API bool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
137 CSFML_NETWORK_API bool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
138 CSFML_NETWORK_API bool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
Export.h
CSFML_NETWORK_API
#define CSFML_NETWORK_API
Definition Network/Export.h:42
Types.h
sfTcpSocket
struct sfTcpSocket sfTcpSocket
Definition Network/Types.h:38
sfTcpListener
struct sfTcpListener sfTcpListener
Definition Network/Types.h:37
sfSocketSelector
struct sfSocketSelector sfSocketSelector
Definition Network/Types.h:36
sfUdpSocket
struct sfUdpSocket sfUdpSocket
Definition Network/Types.h:39
sfSocketSelector_isTcpListenerReady
bool sfSocketSelector_isTcpListenerReady(const sfSocketSelector *selector, sfTcpListener *socket)
Test a socket to know if it is ready to receive data.
sfSocketSelector_destroy
void sfSocketSelector_destroy(const sfSocketSelector *selector)
Destroy a socket selector.
sfSocketSelector_create
sfSocketSelector * sfSocketSelector_create(void)
Create a new selector.
sfSocketSelector_addTcpSocket
void sfSocketSelector_addTcpSocket(sfSocketSelector *selector, sfTcpSocket *socket)
sfSocketSelector_copy
sfSocketSelector * sfSocketSelector_copy(const sfSocketSelector *selector)
Create a new socket selector by copying an existing one.
sfSocketSelector_isUdpSocketReady
bool sfSocketSelector_isUdpSocketReady(const sfSocketSelector *selector, sfUdpSocket *socket)
sfSocketSelector_wait
bool sfSocketSelector_wait(sfSocketSelector *selector, sfTime timeout)
Wait until one or more sockets are ready to receive.
sfSocketSelector_addUdpSocket
void sfSocketSelector_addUdpSocket(sfSocketSelector *selector, sfUdpSocket *socket)
sfSocketSelector_addTcpListener
void sfSocketSelector_addTcpListener(sfSocketSelector *selector, sfTcpListener *socket)
Add a new socket to a socket selector.
sfSocketSelector_removeTcpSocket
void sfSocketSelector_removeTcpSocket(sfSocketSelector *selector, sfTcpSocket *socket)
sfSocketSelector_clear
void sfSocketSelector_clear(sfSocketSelector *selector)
Remove all the sockets stored in a selector.
sfSocketSelector_removeTcpListener
void sfSocketSelector_removeTcpListener(sfSocketSelector *selector, sfTcpListener *socket)
Remove a socket from a socket selector.
sfSocketSelector_removeUdpSocket
void sfSocketSelector_removeUdpSocket(sfSocketSelector *selector, sfUdpSocket *socket)
sfSocketSelector_isTcpSocketReady
bool sfSocketSelector_isTcpSocketReady(const sfSocketSelector *selector, sfTcpSocket *socket)
Time.h
sfTime
Represents a time value.
Definition Time.h:38