-std::for_each(
- rsu.routers.begin(),
- rsu.routers.end(),
- PacketSender(sock, buffer, sizeof(buffer), static_cast<uint16_t>(htons(rsSettings.GetPort())))
- );
+for (const auto& ip : rsu.routers)
+{
+ struct sockaddr_in sendAddr;
+
+ sendAddr.sin_family = AF_INET;
+ sendAddr.sin_port = htons(rsSettings.GetPort());
+ sendAddr.sin_addr.s_addr = ip;
+
+ return sendto(sock, buffer, sizeof(buffer), 0, reinterpret_cast<struct sockaddr*>(&sendAddr), sizeof(sendAddr)) > 0;
+}