Refactored local variable socket to server