Reputation: 2952
I am using websocketpp to run a websocket server. However, when I close the application and start it again, I get the error:
[info] asio listen error: system:98 (Address already in use)
It seems like I have to set reuse_address
in the asio socket. I have not found any documentation how to do it.
How can I let the websocket server reuse the address?
Upvotes: 1
Views: 2567
Reputation: 2847
According to this help page it looks like there is a set_reuse_addr()
function exposed, this may help?
Synopsis:
void set_reuse_addr (bool value)
Specifies whether or not to use the SO_REUSEADDR TCP socket option. What this flag does depends on your operating system.
Please consult operating system documentation for more details. There may be security consequences to enabling this option.
New values affect future calls to listen only so set this value prior to calling listen.
The default is false.
Upvotes: 7