Skip to content

Avoid BindException after restart#710

Open
lovebing wants to merge 4 commits into
mrniko:masterfrom
lovebing:master
Open

Avoid BindException after restart#710
lovebing wants to merge 4 commits into
mrniko:masterfrom
lovebing:master

Conversation

@lovebing

Copy link
Copy Markdown
Contributor

Sometimes server start failed after restart, like:
#687
#698
Some developers don't know how to solve this problem, so I think this is a good idea to set the default value of SocketConfig.reuseAddress to true. It can avoid the BindException.

@cs6402 cs6402 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@recon88

recon88 commented Dec 29, 2019

Copy link
Copy Markdown

You can change the field through the available public method in SocketConfig (See Wiki).

Configuration configuration = new Configuration();
SocketConfig socketConfig = configuration.getSocketConfig();
socketConfig.setReuseAddress(true);

That's all you need

@kylooh

kylooh commented Apr 9, 2020

Copy link
Copy Markdown

You can change the field through the available public method in SocketConfig (See Wiki).

Configuration configuration = new Configuration();
SocketConfig socketConfig = configuration.getSocketConfig();
socketConfig.setReuseAddress(true);

That's all you need

TRIED, BUT NOT WORK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants