Implementation of login with sockets