add simple logic for socket