modify socket logic