mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
wait until socket can be bind
This commit is contained in:
parent
6eee1214a2
commit
aa6f72e7ed
2 changed files with 3 additions and 2 deletions
|
|
@ -32,10 +32,10 @@ int setup_broadcast_socket(const char *_broadcast_ip, unsigned short _broadcast_
|
|||
addr->sin_addr.s_addr = inet_addr(_broadcast_ip);
|
||||
addr->sin_port = htons(_broadcast_port);
|
||||
|
||||
if (bind(sock, (struct sockaddr *) addr, sizeof(*addr)) <
|
||||
while (bind(sock, (struct sockaddr *) addr, sizeof(*addr)) <
|
||||
0) {
|
||||
fprintf(stderr, "Binding socket failed!\n");
|
||||
return -1;
|
||||
sleep(1);
|
||||
}
|
||||
return sock;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue