adding code for socket handler