Files
DisplayFlow/demo/windows_sender/NetworkSender.h

31 lines
647 B
C
Raw Normal View History

2025-12-18 23:07:14 +08:00
#pragma once
#include <winsock2.h>
#include <ws2tcpip.h>
#include <string>
#include <vector>
#include <cstdint>
#pragma comment(lib, "ws2_32.lib")
struct PacketHeader {
uint64_t timestamp;
uint32_t width;
uint32_t height;
uint32_t frameType; // 0=I, 1=P
uint32_t dataSize;
};
class NetworkSender {
public:
NetworkSender();
~NetworkSender();
2025-12-19 15:28:38 +08:00
bool Initialize(const std::vector<std::string>& ips, int port);
2025-12-18 23:07:14 +08:00
bool SendFrame(const std::vector<uint8_t>& data, uint64_t timestamp, int width, int height, bool isKeyFrame);
private:
SOCKET socket_ = INVALID_SOCKET;
2025-12-19 15:28:38 +08:00
std::vector<sockaddr_in> destAddrs_;
2025-12-18 23:07:14 +08:00
};