Go to the source code of this file.
|
CSFML_NETWORK_API
sfSocketSelector * | sfSocketSelector_create (void) |
| Create a new selector.
|
|
CSFML_NETWORK_API
sfSocketSelector * | sfSocketSelector_copy (const sfSocketSelector *selector) |
| Create a new socket selector by copying an existing one.
|
|
CSFML_NETWORK_API void | sfSocketSelector_destroy (sfSocketSelector *selector) |
| Destroy a socket selector.
|
|
CSFML_NETWORK_API void | sfSocketSelector_addTcpListener (sfSocketSelector *selector, sfTcpListener *socket) |
| Add a new socket to a socket selector.
|
|
CSFML_NETWORK_API void | sfSocketSelector_addTcpSocket (sfSocketSelector *selector, sfTcpSocket *socket) |
|
CSFML_NETWORK_API void | sfSocketSelector_addUdpSocket (sfSocketSelector *selector, sfUdpSocket *socket) |
|
CSFML_NETWORK_API void | sfSocketSelector_removeTcpListener (sfSocketSelector *selector, sfTcpListener *socket) |
| Remove a socket from a socket selector.
|
|
CSFML_NETWORK_API void | sfSocketSelector_removeTcpSocket (sfSocketSelector *selector, sfTcpSocket *socket) |
|
CSFML_NETWORK_API void | sfSocketSelector_removeUdpSocket (sfSocketSelector *selector, sfUdpSocket *socket) |
|
CSFML_NETWORK_API void | sfSocketSelector_clear (sfSocketSelector *selector) |
| Remove all the sockets stored in a selector.
|
|
CSFML_NETWORK_API sfBool | sfSocketSelector_wait (sfSocketSelector *selector, sfTime timeout) |
| Wait until one or more sockets are ready to receive.
|
|
CSFML_NETWORK_API sfBool | sfSocketSelector_isTcpListenerReady (const sfSocketSelector *selector, sfTcpListener *socket) |
| Test a socket to know if it is ready to receive data.
|
|
CSFML_NETWORK_API sfBool | sfSocketSelector_isTcpSocketReady (const sfSocketSelector *selector, sfTcpSocket *socket) |
|
CSFML_NETWORK_API sfBool | sfSocketSelector_isUdpSocketReady (const sfSocketSelector *selector, sfUdpSocket *socket) |
|
Add a new socket to a socket selector.
This function keeps a weak pointer to the socket, so you have to make sure that the socket is not destroyed while it is stored in the selector.
- Parameters
-
selector | Socket selector object |
socket | Pointer to the socket to add |
Remove all the sockets stored in a selector.
This function doesn't destroy any instance, it simply removes all the pointers that the selector has to external sockets.
- Parameters
-
selector | Socket selector object |
Create a new socket selector by copying an existing one.
- Parameters
-
selector | Socket selector to copy |
- Returns
- A new sfSocketSelector object which is a copy of selector
Create a new selector.
- Returns
- A new sfSocketSelector object
Destroy a socket selector.
- Parameters
-
selector | Socket selector to destroy |
Test a socket to know if it is ready to receive data.
This function must be used after a call to sfSocketSelector_wait, to know which sockets are ready to receive data. If a socket is ready, a call to Receive will never block because we know that there is data available to read. Note that if this function returns sfTrue for a sfTcpListener, this means that it is ready to accept a new connection.
- Parameters
-
selector | Socket selector object |
socket | Socket to test |
- Returns
- sfTrue if the socket is ready to read, sfFalse otherwise
Remove a socket from a socket selector.
This function doesn't destroy the socket, it simply removes the pointer that the selector has to it.
- Parameters
-
selector | Socket selector object |
socket | POointer to the socket to remove |
Wait until one or more sockets are ready to receive.
This function returns as soon as at least one socket has some data available to be received. To know which sockets are ready, use the sfSocketSelector_isXxxReady functions. If you use a timeout and no socket is ready before the timeout is over, the function returns sfFalse.
- Parameters
-
selector | Socket selector object |
timeout | Maximum time to wait (use sfTimeZero for infinity) |
- Returns
- sfTrue if there are sockets ready, sfFalse otherwise