Files
Tower-Defense/include/td/network/UDPSocket.h
2023-08-13 11:59:13 +02:00

32 lines
601 B
C++

#ifndef NETWORK_UDP_SOCKET_H_
#define NETWORK_UDP_SOCKET_H_
#include "td/network/IPAddress.h"
#include "td/network/Socket.h"
#include <cstdint>
namespace td {
namespace network {
class UDPSocket : public Socket {
private:
IPAddress m_RemoteIP;
uint16_t m_Port;
sockaddr_in m_RemoteAddr;
public:
UDPSocket();
bool Connect(const IPAddress& address, std::uint16_t port);
std::size_t Send(const std::uint8_t* data, std::size_t size);
virtual DataBuffer Receive(std::size_t amount);
virtual std::size_t Receive(DataBuffer& buffer, std::size_t amount);
};
} // ns network
} // ns td
#endif