move read from tcp stream to login function. Previously this streaming was in write function and it was bug