Update deleteAllAdhocSockets

This commit is contained in:
AdamN authored and GitHub committed 2024-06-29 00:57:16 +07:00
1 parent 9e8e43f7b7
commit c389ede092
1 file changed
+5 -1
+5 -1
View File
@@ -429,7 +429,11 @@ void deleteAllAdhocSockets() {
if (fd > 0) {
// Close Socket
shutdown(fd, SD_BOTH);
struct linger sl {};
sl.l_onoff = 1; // non-zero value enables linger option in kernel
sl.l_linger = 0; // timeout interval in seconds
setsockopt(fd, SOL_SOCKET, SO_LINGER, (const char*)&sl, sizeof(sl));
shutdown(fd, SD_RECEIVE);
closesocket(fd);
}
// Free Memory