Commit 6a26975f authored by Lionel Flandrin's avatar Lionel Flandrin
Browse files

Add SO_REUSEADDR to gdb socket to avoid "address already in use" errors on restart

parent a5658801
...@@ -160,6 +160,7 @@ Listen(unsigned int iPort) ...@@ -160,6 +160,7 @@ Listen(unsigned int iPort)
unsigned int addrlen; unsigned int addrlen;
struct sockaddr_in sin; struct sockaddr_in sin;
struct sockaddr_in pin; struct sockaddr_in pin;
int so_reuseaddr = 1;
int sdListen; int sdListen;
// //
...@@ -170,6 +171,13 @@ Listen(unsigned int iPort) ...@@ -170,6 +171,13 @@ Listen(unsigned int iPort)
return(-1); return(-1);
} }
// Attempt to set SO_REUSEADDR to avoid "address already in use" errors
setsockopt(sdListen,
SOL_SOCKET,
SO_REUSEADDR,
&so_reuseaddr,
sizeof(so_reuseaddr));
// //
// Set up to listen on all interfaces/addresses and port iPort // Set up to listen on all interfaces/addresses and port iPort
// //
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment