コード例 #1
0
ファイル: Server.cs プロジェクト: MirageNet/Libuv2kNG
        /// <summary>
        ///     Queue up connections that are trying to connect.
        /// </summary>
        /// <param name="handle">The stream which is trying to connect to server.</param>
        /// <param name="error"></param>
        private void OnLibuvServerConnected(TcpStream handle, Exception error)
        {
            Libuv2kNGLogger.Log("libuv server: client connected =" + handle.GetPeerEndPoint().Address);

            // close if errors (AFTER setting up onClosed callback!)
            if (error != null)
            {
                Libuv2kNGLogger.Log($"libuv server: client connection failed {error}");

                handle.Dispose();

                return;
            }

            var newClient = new Libuv2kConnection(true, handle);

            _transport.Connected.Invoke(newClient);
        }
コード例 #2
0
 /// <summary>
 ///     the address of endpoint we are connected to
 ///     Note this can be IPEndPoint or a custom implementation
 ///     of EndPoint, which depends on the transport
 /// </summary>
 /// <returns></returns>
 public EndPoint GetEndPointAddress()
 {
     return(_client?.GetPeerEndPoint());
 }