From 218c0d7385da7bc2bb4c8080e40524b58139e072 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 30 Nov 2018 00:32:57 -0800 Subject: [PATCH] Increase SSDP UDP socket recv buffer size --- miss/tracer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/miss/tracer.cpp b/miss/tracer.cpp index 57f55c6..4966e25 100644 --- a/miss/tracer.cpp +++ b/miss/tracer.cpp @@ -47,6 +47,13 @@ struct UPNPDev* getUPnPDevicesByAddress(IN_ADDR address) return nullptr; } + // We will be reading all responses at the end, so ensure we have ample buffer space + // to allow responses to accumulate without loss. + int recvBufferSize = 65535; + if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char*)&recvBufferSize, sizeof(recvBufferSize)) == SOCKET_ERROR) { + printf("setsockopt() failed: %d\n", WSAGetLastError()); + } + // Send the first search message with HOST set properly chars = snprintf(searchBuffer, ARRAYSIZE(searchBuffer), k_SsdpSearchFormatString, inet_ntoa(address)); if (send(s, searchBuffer, chars, 0) == SOCKET_ERROR) {