public void connectUntilSuss(onConnect onConnect)
        {
            Thread x = new Thread(() =>
            {
                while (true)
                {
                    try
                    {
                        tcpClient     = new TcpClient(ip, host);
                        stream        = new AdvanceStream(tcpClient.GetStream());
                        isServerReady = true;
                        onConnect.Invoke(stream);
                        if (tcpClient != null)
                        {
                            break;
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
            });

            x.IsBackground = true;
            x.Start();
        }
 public void connect(onConnect onConnect)
 {
     try
     {
         tcpClient = new TcpClient(ip, host);
         stream    = new AdvanceStream(tcpClient.GetStream());
         onConnect.Invoke(stream);
     }
     catch (Exception e) {
         logger.Invoke("Error while connect to server " + e.Message);
     }
 }