/// <summary> /// Connects to a remote server in the background. /// </summary> /// <param name="connection">The connection to use to connect to the server.</param> /// <param name="callback">The callback to invoke one the connection attempt has finished.</param> public void ConnectInBackground(NetworkClientConnection connection, ConnectCompleteHandler callback = null) { new Thread( delegate() { try { Connect(connection); } catch (Exception e) { callback?.Invoke(e); return; } callback?.Invoke(null); } ).Start(); }