adding condition where i reset the socket