The socket handler(extracted from client)