internal TcpClientTransportSink(String channelURI, TcpClientChannel channel)
        {
            String objectURI;

            _channel = channel;
            String simpleChannelUri = TcpChannelHelper.ParseURL(channelURI, out objectURI);

            ClientSocketCache = new SocketCache(new SocketHandlerFactory(this.CreateSocketHandler), _socketCachePolicy,
                                                _socketCacheTimeout);
            // extract machine name and port
            Uri uri = new Uri(simpleChannelUri);

            if (uri.IsDefaultPort)
            {
                // If there is no colon, then there is no port number.
                throw new RemotingException(
                          String.Format(
                              CultureInfo.CurrentCulture, CoreChannel.GetResourceString(
                                  "Remoting_Tcp_UrlMustHavePort"),
                              channelURI));
            }
            m_machineName = uri.Host;
            m_port        = uri.Port;

            _machineAndPort = m_machineName + ":" + m_port;
        } // TcpClientTransportSink
        private SocketHandler CreateSocketHandler(Socket socket, SocketCache socketCache, string machinePortAndSid)
        {
            Stream netStream = new SocketStream(socket);

            if (this._channel.IsSecured)
            {
                netStream = this.CreateAuthenticatedStream(netStream, machinePortAndSid);
            }
            return(new TcpClientSocketHandler(socket, machinePortAndSid, netStream, this));
        }
        private SocketHandler CreateSocketHandler(
            Socket socket, SocketCache socketCache, String machinePortAndSid)
        {
            Stream netStream = new SocketStream(socket);

            // Check if authentication is requested
            if (_channel.IsSecured)
            {
                throw new NotSupportedException();
            }

            return(new TcpClientSocketHandler(socket, machinePortAndSid, netStream, this));
        } // CreateSocketHandler
        internal TcpClientTransportSink(string channelURI, TcpClientChannel channel)
        {
            string str;

            this._socketCacheTimeout = TimeSpan.FromSeconds(10.0);
            this._spn        = string.Empty;
            this._retryCount = 1;
            this._tokenImpersonationLevel = TokenImpersonationLevel.Identification;
            this._protectionLevel         = ProtectionLevel.EncryptAndSign;
            this._channel = channel;
            string uriString = TcpChannelHelper.ParseURL(channelURI, out str);

            this.ClientSocketCache = new SocketCache(new SocketHandlerFactory(this.CreateSocketHandler), this._socketCachePolicy, this._socketCacheTimeout);
            Uri uri = new Uri(uriString);

            if (uri.IsDefaultPort)
            {
                throw new RemotingException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Tcp_UrlMustHavePort"), new object[] { channelURI }));
            }
            this.m_machineName   = uri.Host;
            this.m_port          = uri.Port;
            this._machineAndPort = this.m_machineName + ":" + this.m_port;
        }
예제 #5
0
 private static SocketHandler CreateSocketHandler(
     Socket socket, SocketCache socketCache, String machineAndPort)
 {
     return(new TcpClientSocketHandler(socket, machineAndPort));
 } // CreateSocketHandler