Exemple #1
0
        private void SetupTransport(Transport transport, ILoggerFactory loggerFactory)
        {
            transport.OnUpdateConnectionState = UpdateConnectionState;
            transport.OnDetectAndReceive      = DetectAndReceive;
            transport.OnGetConnectionState    = () => ConnectionState;

            if (transport.Configuration is ClientSocketConfiguration)
            {
                transport.OnNewSocketConnected = null;
                transport.ConfigureClient(loggerFactory);
                _isServerConnection = false;
            }
            else if (transport.Configuration is ServerSocketConfiguration)
            {
                transport.OnNewSocketConnected = OnNewSocketConnected;
                transport.ConfigureServer(loggerFactory);
                _isServerConnection = true;
            }
        }