Use SO_REUSEADDR socket option.