refactor Linux connect