fix name resolution problem
Add a test
Add reuseaddr option