Fixed server to work with sockets