Example #1
0
    /// <summary>
    /// Connecting to the server by IP address, specifying the password for connection and connection attempts (All connection errors will be returned by the OnDisconnected method)
    /// </summary>
    public ConnectionAttemptResult Connect(string address, ushort port, string password = "", short attempts = 20)
    {
        ConnectionAttemptResult result = peer.StartClient(address, port, password, attempts);

        if (result == ConnectionAttemptResult.CONNECTION_ATTEMPT_STARTED)
        {
            IsConnecting = true;
            IsConnected  = false;
            OnConnecting(address, port, password);
        }
        return(result);
    }