works on sockets