Tag: broadcast

UDP message sent off wrong network interface

This is a funny one and I wonder what is exactly causing such misbehavior. An UDP broadcasting socket is being bound to IP address 192.168.0.2: __E(m_Socket.Create(SOCK_DGRAM, IPPROTO_UDP) != INVALID_SOCKET); static const DWORD g_nBroadcastValue = 1; __E(m_Socket.SetOption(SOL_SOCKET, SO_BROADCAST, &g_nBroadcastValue, sizeof g_nBroadcastValue)); ZeroMemory(&m_LocalAddress, sizeof m_LocalAddress); m_LocalAddress.sin_family = AF_INET; m_LocalAddress.sin_port = htons(nPort); // 7365 m_LocalAddress.sin_addr.S_un.S_addr = htonl(nLocalIpAddress); //…

Read the full article