change socket logic