Files
ConnectTools/steamnet/control_packets.cpp
Ayndpa af181bb133 Refactor Steam Networking Components
- Removed SteamMessageHandler class and its implementation files.
- Integrated control packet handling directly into the SteamMessageHandler.
- Updated TCPClient and TCPServer classes to improve connection management and error handling.
- Added SteamNetworkingManager class to manage Steam networking, including lobby creation and connection handling.
- Implemented callbacks for Steam Friends and Matchmaking to handle lobby events.
- Enhanced message forwarding logic between TCP clients and Steam connections.
- Introduced control packet handling for ping responses.
- Improved thread safety with mutexes for shared resources.
2025-11-18 21:03:01 +08:00

19 lines
745 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "control_packets.h"
#include <iostream>
#include <string_view>
// 假设需要访问全局变量,但为了简单,这里只打印
// 如果需要,可以传递引用或使用全局
void handleControlPacket(const char* data, size_t size, HSteamNetConnection conn) {
std::string_view packetData(data, size);
std::cout << "Received control packet: " << packetData << " from connection " << conn << std::endl;
// 这里添加处理逻辑例如解析JSON或命令
// 例如如果data是"ping",回复"pong"
if (packetData == "ping") {
// 发送回复,但需要接口
// 暂时只打印
std::cout << "Responding to ping" << std::endl;
}
// 可以扩展为更多控制命令
}