当前位置: 首页>>代码示例>>C#>>正文


C# ISocket.Authenticate方法代码示例

本文整理汇总了C#中ISocket.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# ISocket.Authenticate方法的具体用法?C# ISocket.Authenticate怎么用?C# ISocket.Authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISocket的用法示例。


在下文中一共展示了ISocket.Authenticate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnClientConnect

        private void OnClientConnect(ISocket clientSocket)
        {
            if (clientSocket == null) return; // socket closed

            FleckLog.Debug(String.Format("Client connected from {0}:{1}", clientSocket.RemoteIpAddress, clientSocket.RemotePort.ToString()));
            ListenForClients();

            WebSocketConnection connection = null;

            connection = new WebSocketConnection(
                clientSocket,
                _config,
                bytes => RequestParser.Parse(bytes, _scheme),
                r => HandlerFactory.BuildHandler(r,
                                                 s => connection.OnMessage(s),
                                                 connection.Close,
                                                 b => connection.OnBinary(b),
                                                 b => connection.OnPing(b),
                                                 b => connection.OnPong(b)),
                s => SubProtocolNegotiator.Negotiate(SupportedSubProtocols, s));

            if (IsSecure)
            {
                FleckLog.Debug("Authenticating Secure Connection");
                clientSocket
                    .Authenticate(Certificate,
                                  EnabledSslProtocols,
                                  connection.StartReceiving,
                                  e => FleckLog.Warn("Failed to Authenticate", e));
            }
            else
            {
                connection.StartReceiving();
            }
        }
开发者ID:recallfx,项目名称:Fleck,代码行数:35,代码来源:WebSocketServer.cs

示例2: OnClientConnect

        private void OnClientConnect(ISocket clientSocket)
        {
            FleckLog.Debug(String.Format("Client connected from {0}:{1}", clientSocket.RemoteIpAddress, clientSocket.RemotePort.ToString()));
            ListenForClients();

            WebSocketConnection connection = null;

            connection = new WebSocketConnection(
                clientSocket,
                _config,
                bytes => RequestParser.Parse(bytes, _scheme, AccessPolicyServer, clientSocket),
                r => HandlerFactory.BuildHandler(r,
                                                 s => connection.OnMessage(s),
                                                 connection.Close,
                                                 b => connection.OnBinary(b)));

            if (IsSecure)
            {
                FleckLog.Debug("Authenticating Secure Connection");
                clientSocket
                    .Authenticate(Certificate,
                                  connection.StartReceiving,
                                  e => FleckLog.Warn("Failed to Authenticate", e));
            }
            else
            {
                connection.StartReceiving();
            }
        }
开发者ID:vbguyny,项目名称:Fleck,代码行数:29,代码来源:WebSocketServer.cs

示例3: OnClientConnect

        private void OnClientConnect(ISocket clientSocket)
        {
            this.ListenForClients();

            WebSocketConnection connection = null;
            connection = new WebSocketConnection(clientSocket, this.scheme);
            connection.MessageReceived += new EventHandler<TextMessageHandledEventArgs>(this.ConnectionMessageReceivedEventHandler);
            connection.BinaryMessageReceived += new EventHandler<BinaryMessageHandledEventArgs>(this.ConnectionBinaryMessageReceivedEventHandler);
            connection.Opened += new EventHandler<ConnectionEventArgs>(this.ConnectionOpenedEventHandler);
            connection.Closed += new EventHandler<ConnectionEventArgs>(this.ConnectionClosedEventHandler);
            connection.ErrorReceived += new EventHandler<ErrorEventArgs>(this.ConnectionErrorEventHandler);
            connection.StandardHttpRequestReceived += new EventHandler<StandardHttpRequestReceivedEventArgs>(this.ConnectionStandardHttpRequestReceivedEventHandler);

            if (this.IsSecure)
            {
                clientSocket.Authenticated += new EventHandler(this.SocketAuthenticatedEventHandler);
                clientSocket.Authenticate(this.authenticationX509Certificate);
            }
            else
            {
                connection.StartReceiving();
            }
        }
开发者ID:kaushik9k,项目名称:Selenium2,代码行数:23,代码来源:WebSocketServer.cs

示例4: OnClientConnect

        private void OnClientConnect(ISocket clientSocket)
        {
            FleckLog.Debug("Client Connected");
            ListenForClients();

            WebSocketConnection connection = null;

            connection = new WebSocketConnection(
                clientSocket,
                bytes => RequestParser.Parse(bytes, _scheme),
                r => HandlerFactory.BuildHandler(r, s => connection.OnMessage(s),
                                                         connection.Close));

            _config(connection);

            if (IsSecure)
            {
                FleckLog.Debug("Authenticating Secure Connection");
                clientSocket
                    .Authenticate(_x509Certificate,
                                  connection.StartReceiving,
                                  e => FleckLog.Warn("Failed to Authenticate", e));
            }
            else
            {
                connection.StartReceiving();
            }
        }
开发者ID:charles-cai,项目名称:Fleck,代码行数:28,代码来源:WebSocketServer.cs

示例5: OnClientConnect

        private void OnClientConnect(ISocket clientSocket)
        {
            FleckLog.Debug("Client Connected");
            ListenForClients();

            var connection = new WebSocketConnection(clientSocket, new DefaultHandlerFactory(_scheme));
            _config(connection);

            if (IsSecure)
            {
                FleckLog.Debug("Authenticating Secure Connection");
                clientSocket
                    .Authenticate(_x509Certificate,
                                  connection.StartReceiving,
                                  e => FleckLog.Warn("Failed to Authenticate", e));
            }
            else
            {
                connection.StartReceiving();
            }
        }
开发者ID:smerrell,项目名称:Fleck,代码行数:21,代码来源:WebSocketServer.cs


注:本文中的ISocket.Authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。