mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 09:39:33 +00:00
Catch port bind error in simulation
This commit is contained in:
parent
b19270f14e
commit
6028b8a617
@ -22,7 +22,10 @@ void setupWiFi() {
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = INADDR_ANY;
|
||||
addr.sin_port = htons(WIFI_UDP_PORT_LOCAL);
|
||||
bind(wifiSocket, (sockaddr *)&addr, sizeof(addr));
|
||||
if (bind(wifiSocket, (sockaddr *)&addr, sizeof(addr))) {
|
||||
gzerr << "Failed to bind WiFi UDP socket on port " << WIFI_UDP_PORT_LOCAL << std::endl;
|
||||
return;
|
||||
}
|
||||
int broadcast = 1;
|
||||
setsockopt(wifiSocket, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)); // enable broadcast
|
||||
gzmsg << "WiFi UDP socket initialized on port " << WIFI_UDP_PORT_LOCAL << " (remote port " << WIFI_UDP_PORT_REMOTE << ")" << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user