/// <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(); }
public void ConnectInBackground(IPAddress ip, int port, IPVersion ipVersion, bool noDelay, ConnectCompleteHandler callback = null) { ConnectInBackground(new BichannelClientConnection(ipVersion, ip, port, noDelay), callback); }
/// <summary> /// Connects to a remote server in the background using a <see cref="BichannelClientConnection"/>. /// </summary> /// <param name="ip">The IP address of the server.</param> /// <param name="tcpPort">The port the server is listening on for TCP.</param> /// <param name="udpPort">The port the server is listening on for UDP.</param> /// <param name="callback">The callback to invoke one the connection attempt has finished.</param> /// <param name="noDelay">Whether to disable Nagel's algorithm or not.</param> public void ConnectInBackground(IPAddress ip, int tcpPort, int udpPort, bool noDelay, ConnectCompleteHandler callback = null) { ConnectInBackground(new BichannelClientConnection(ip, tcpPort, udpPort, noDelay), callback); }
public void ConnectInBackground(IPAddress ip, int port, IPVersion ipVersion, ConnectCompleteHandler callback = null) { ConnectInBackground(ip, port, ipVersion, false, callback); }