Server: refactoring and fixed problems with sockets(actually there is need to maintain new versions of libraries)