add some code for sockets