1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Some minor cleanups for UDPSocket class

This commit is contained in:
sfan5 2024-01-01 16:08:53 +01:00
parent dc7fb26921
commit 20692d54de
2 changed files with 27 additions and 17 deletions

View file

@ -34,23 +34,24 @@ class UDPSocket
{
public:
UDPSocket() = default;
UDPSocket(bool ipv6);
UDPSocket(bool ipv6); // calls init()
~UDPSocket();
void Bind(Address addr);
bool init(bool ipv6, bool noExceptions = false);
void Bind(Address addr);
void Send(const Address &destination, const void *data, int size);
// Returns -1 if there is no data
int Receive(Address &sender, void *data, int size);
int GetHandle(); // For debugging purposes only
void setTimeoutMs(int timeout_ms);
// Returns true if there is data, false if timeout occurred
bool WaitData(int timeout_ms);
// Debugging purposes only
int GetHandle() const { return m_handle; };
private:
int m_handle;
int m_timeout_ms;
int m_addr_family;
int m_handle = -1;
int m_timeout_ms = -1;
unsigned short m_addr_family = 0;
};