reimpletements socket on connection for better performance