Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <algorithm>
- #include <cstdlib>
- #include <iomanip>
- #include <iostream>
- #include <string>
- #include "socket_wrap.h"
- // Trim from end (in place).
- static inline std::string& rtrim(std::string& s)
- {
- s.erase(std::find_if(s.rbegin(), s.rend(), [](int c) { return !std::isspace(c); }).base());
- return s;
- }
- class UDPServer
- {
- public:
- UDPServer(unsigned short port);
- void listenUDP();
- ~UDPServer();
- private:
- socket_wrapper::Socket m_sock;
- socket_wrapper::SocketWrapper m_sock_wrap;
- unsigned short m_port;
- struct sockaddr_in m_client_address;
- socklen_t m_client_address_len;
- ssize_t m_recv_len;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement