mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-22 19:52:49 +02:00
atrf-proxy.c (loop): use SO_REUSEADDR to avoid "address already in use"
This commit is contained in:
parent
8c5d21b0d7
commit
02b80879bf
@ -239,6 +239,7 @@ static void loop(const char *driver, int port)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
int s;
|
||||
int one = 1;
|
||||
|
||||
s = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
@ -246,6 +247,11 @@ static void loop(const char *driver, int port)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0) {
|
||||
perror("setsockopt");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
Loading…
Reference in New Issue
Block a user