Separate udp socket implementation from generic socket

This commit is contained in:
momo5502
2025-01-11 20:56:50 +01:00
parent 32faf2ba1f
commit c8c1e000a3
4 changed files with 106 additions and 50 deletions

View File

@@ -0,0 +1,22 @@
#pragma once
#include "socket.hpp"
#include <string_view>
namespace network
{
struct udp_socket : socket
{
udp_socket(int af);
udp_socket() = default;
~udp_socket() = default;
udp_socket(udp_socket&& obj) noexcept = default;
udp_socket& operator=(udp_socket&& obj) noexcept = default;
[[maybe_unused]] bool send(const address& target, const void* data, size_t size) const;
[[maybe_unused]] bool send(const address& target, std::string_view data) const;
bool receive(address& source, std::string& data) const;
};
}