#pragma once #include #include #include #define DEFAULT_MAX_PACKET_SIZE 512 class UDPbase { int m_channel; IPaddress m_address; void CloseAllSockets (void); protected: std::vector m_socks; public: UDPbase (const char*, const Uint16); UDPbase (const char*, const Uint16, const int); ~UDPbase (void); int ResolveHost (IPaddress*, const char*, const Uint16); UDPsocket UDP_Open (void); UDPsocket UDP_Open (const Uint16 port); void UDP_Close (UDPsocket sock); int UDP_Bind (UDPsocket sock, const int channel); void UDP_Unbind (UDPsocket sock, const int channel); IPaddress* UDP_GetPeerAddress (UDPsocket sock, const int channel); /* ======================================================= */ int channel (void) const { return m_channel; } UDPsocket get (const size_t idx) const { return m_socks.at (idx); } std::string toString (void); };