Commit 1637e7a1 authored by Edoardo Lolletti's avatar Edoardo Lolletti

Make broadcast socket use SO_REUSEADDR

This allows multiple instances of the client to listen from broadcast messages at the same time on the same port
parent 6d7ff3fc
......@@ -42,6 +42,7 @@ bool NetServer::StartBroadcast() {
SOCKET udp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
BOOL opt = TRUE;
setsockopt(udp, SOL_SOCKET, SO_BROADCAST, (const char*)&opt, sizeof(BOOL));
setsockopt(udp, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(BOOL));
sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment