mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Update Network module code
This commit is contained in:
1 parent
2adc2db065
commit
58cd82b532
9 files changed
+98
-2
No files matched your search
@@ -132,7 +132,7 @@ CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
|
||||
/// address, and should be used for optimization purposes only
|
||||
/// (like sending the address through a socket).
|
||||
/// The integer produced by this function can then be converted
|
||||
/// back to a sfIpAddress with sfIpAddress_FromInteger.
|
||||
/// back to a sfIpAddress with sfIpAddress_fromInteger.
|
||||
///
|
||||
/// \param address Address object
|
||||
///
|
||||
|
||||
@@ -75,6 +75,8 @@ CSFML_NETWORK_API void sfPacket_append(sfPacket* packet, const void* data, size_
|
||||
///
|
||||
/// The next read operation will read data from this position
|
||||
///
|
||||
/// \param packet Packet object
|
||||
///
|
||||
/// \return The byte offset of the current read position
|
||||
///
|
||||
/// \see append
|
||||
@@ -163,6 +165,8 @@ CSFML_NETWORK_API int16_t sfPacket_readInt16(sfPacket* packet);
|
||||
CSFML_NETWORK_API uint16_t sfPacket_readUint16(sfPacket* packet);
|
||||
CSFML_NETWORK_API int32_t sfPacket_readInt32(sfPacket* packet);
|
||||
CSFML_NETWORK_API uint32_t sfPacket_readUint32(sfPacket* packet);
|
||||
CSFML_NETWORK_API int64_t sfPacket_readInt64(sfPacket* packet);
|
||||
CSFML_NETWORK_API uint64_t sfPacket_readUint64(sfPacket* packet);
|
||||
CSFML_NETWORK_API float sfPacket_readFloat(sfPacket* packet);
|
||||
CSFML_NETWORK_API double sfPacket_readDouble(sfPacket* packet);
|
||||
CSFML_NETWORK_API void sfPacket_readString(sfPacket* packet, char* string);
|
||||
@@ -181,6 +185,8 @@ CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, int16_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, uint16_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, int32_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, uint32_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeInt64(sfPacket* packet, int64_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeUint64(sfPacket* packet, uint64_t);
|
||||
CSFML_NETWORK_API void sfPacket_writeFloat(sfPacket* packet, float);
|
||||
CSFML_NETWORK_API void sfPacket_writeDouble(sfPacket* packet, double);
|
||||
CSFML_NETWORK_API void sfPacket_writeString(sfPacket* packet, const char* string);
|
||||
|
||||
@@ -99,6 +99,10 @@ CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener*
|
||||
/// If the socket was previously listening to another port,
|
||||
/// it will be stopped first and bound to the new port.
|
||||
///
|
||||
/// When providing `sfTcpListener_anyPort()` as port, the listener
|
||||
/// will request an available port from the system.
|
||||
/// The chosen port can be retrieved by calling `sfTcpListener_getLocalPort()`.
|
||||
///
|
||||
/// If there is no specific address to listen to, pass sfIpAddress_Any
|
||||
///
|
||||
/// \param listener TCP listener object
|
||||
@@ -110,6 +114,17 @@ CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener*
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stop listening and close the socket
|
||||
///
|
||||
/// This function gracefully stops the listener. If the
|
||||
/// socket is not listening, this function has no effect.
|
||||
///
|
||||
/// \param listener TCP listener object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfTcpListener_close(sfTcpListener* listener);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Accept a new connection
|
||||
///
|
||||
@@ -127,3 +142,12 @@ CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, u
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** connected);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the special value that tells the system
|
||||
/// to pick any available port
|
||||
///
|
||||
/// \return The value to use for any port
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API unsigned short sfTcpListener_anyPort(void);
|
||||
@@ -102,6 +102,10 @@ CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* soc
|
||||
/// system to automatically pick an available port, and then
|
||||
/// call sfUdpSocket_getLocalPort to retrieve the chosen port.
|
||||
///
|
||||
/// When providing `sfUdpSocket_anyPort()` as port, the listener
|
||||
/// will request an available port from the system.
|
||||
/// The chosen port can be retrieved by calling `sfUdpSocket_getLocalPort()`.
|
||||
///
|
||||
/// If there is no specific address to listen to, pass sfIpAddress_Any
|
||||
///
|
||||
/// \param socket UDP socket object
|
||||
@@ -215,3 +219,12 @@ CSFML_NETWORK_API sfSocketStatus
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the special value that tells the system
|
||||
/// to pick any available port
|
||||
///
|
||||
/// \return The value to use for any port
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API unsigned short sfUdpSocket_anyPort(void);
|
||||
Reference in new issue
Block a user