Socket refactoring: lowered complexity of socket comparison