Created correct connection and disconnection of server to clients, when
clients can not connect, they will try to reconnect. Also threads will be
correctly canceled and started as soon as connection is up for server and
clients