mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-12 11:17:11 +01:00
fix hermes lite enumeration issues and fix copy paste fail in network library
This commit is contained in:
parent
68bf2fc16f
commit
255988ee46
@ -390,7 +390,7 @@ namespace net {
|
|||||||
#endif
|
#endif
|
||||||
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &enable, sizeof(int)) < 0) {
|
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &enable, sizeof(int)) < 0) {
|
||||||
closeSocket(s);
|
closeSocket(s);
|
||||||
throw std::runtime_error("Could not configure socket");
|
throw std::runtime_error("Could not enable broadcast on socket");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,8 +205,8 @@ namespace hermes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Info> discover() {
|
std::vector<Info> discover() {
|
||||||
// TODO: Maybe try to instead detect on each interface as a work around for 0.0.0.0 not receiving anything?
|
// Open a UDP broadcast socket (TODO: Figure out why 255.255.255.255 doesn't work on windows with local = 0.0.0.0)
|
||||||
auto sock = net::openudp("0.0.0.0", 1024);
|
auto sock = net::openudp("255.255.255.255", 1024, "0.0.0.0", 0, true);
|
||||||
|
|
||||||
// Build discovery packet
|
// Build discovery packet
|
||||||
uint8_t discoveryPkt[64];
|
uint8_t discoveryPkt[64];
|
||||||
@ -225,6 +225,7 @@ namespace hermes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Await all responses
|
||||||
std::vector<Info> devices;
|
std::vector<Info> devices;
|
||||||
while (true) {
|
while (true) {
|
||||||
// Wait for a response
|
// Wait for a response
|
||||||
@ -258,7 +259,9 @@ namespace hermes {
|
|||||||
|
|
||||||
devices.push_back(info);
|
devices.push_back(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close broadcast socket
|
||||||
|
sock->close();
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user