From 9bfe3ac6993bc14553667c811a5201e9af549988 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 9 Nov 2025 22:34:11 -0500 Subject: [PATCH] feat: enhance EntityQuery process by dynamically setting EntityServer address and port --- src/OverteClient.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/OverteClient.cpp b/src/OverteClient.cpp index 8c0457d..24fd0f8 100644 --- a/src/OverteClient.cpp +++ b/src/OverteClient.cpp @@ -1099,7 +1099,18 @@ void OverteClient::handleDomainListReply(const char* data, size_t len) { // Try common EntityServer ports (based on web UI showing port 33237) std::cout << "[OverteClient] Trying EntityQuery to common EntityServer ports..." << std::endl; for (uint16_t port : {33237, 33238, 33239, 40103, 48000, 48001}) { - sendEntityQuery(port); + // Temporarily set entity server address to try this port + m_entityServerAddr = m_udpAddr; + sockaddr_in* addr = reinterpret_cast(&m_entityServerAddr); + addr->sin_port = htons(port); + m_entityServerAddrLen = sizeof(sockaddr_in); + m_entityServerPort = port; + + sendEntityQuery(); + + char addrStr[INET_ADDRSTRLEN]; + inet_ntop(AF_INET, &addr->sin_addr, addrStr, sizeof(addrStr)); + std::cout << "[OverteClient] Sent EntityQuery to " << addrStr << ":" << port << std::endl; } } }