示例#1
0
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        {
            _socketCache = socketCache;

            _cachedSocketList = new CachedSocketList();

            // parse "machinename:port"
            String[] parts       = machineAndPort.Split(colonSep);
            String   machineName = parts[0];
            int      port        = Convert.ToInt32(parts[1]);

            _machineAndPort = machineAndPort;

            IPAddress addr = null;

            // we'll just let the exception bubble up if the machineName cannot
            //   be resolved.
            IPHostEntry ipEntries = Dns.Resolve(machineName);

            if ((ipEntries != null) && (ipEntries.AddressList.Length > 0))
            {
                addr = ipEntries.AddressList[0];
            }

            _ipEndPoint = new IPEndPoint(addr, port);
        } // RemoteConnection
示例#2
0
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        {
            _socketCache = socketCache;

            _cachedSocketList = new CachedSocketList();

            // parse "machinename:port"
            String[] parts = machineAndPort.Split(colonSep);
            String machineName = parts[0];
            int port = Convert.ToInt32(parts[1]);
        
            _machineAndPort = machineAndPort;

            IPAddress addr = null;

            // we'll just let the exception bubble up if the machineName cannot
            //   be resolved.
            IPHostEntry ipEntries = Dns.Resolve(machineName);
            if ((ipEntries != null) && (ipEntries.AddressList.Length > 0))
            {
               addr = ipEntries.AddressList[0];
            }               

            _ipEndPoint = new IPEndPoint(addr, port);
        } // RemoteConnection
 internal RemoteConnection(SocketCache socketCache, string machineAndPort)
 {
     this._socketCache = socketCache;
     this._cachedSocketList = new CachedSocketList(socketCache.SocketTimeout, socketCache.CachePolicy);
     this._uri = new Uri("dummy://" + machineAndPort);
     this._port = this._uri.Port;
     this._machineAndPort = machineAndPort;
 }
示例#4
0
 internal RemoteConnection(SocketCache socketCache, string machineAndPort)
 {
     this._socketCache      = socketCache;
     this._cachedSocketList = new CachedSocketList(socketCache.SocketTimeout, socketCache.CachePolicy);
     this._uri            = new Uri("dummy://" + machineAndPort);
     this._port           = this._uri.Port;
     this._machineAndPort = machineAndPort;
 }
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        {
            _socketCache = socketCache;

            _cachedSocketList = new CachedSocketList(socketCache.SocketTimeout,
                                                     socketCache.CachePolicy);

            // parse "machinename:port", add a dummy scheme to get uri parsing
            _uri = new Uri("dummy://" + machineAndPort);

            _port           = _uri.Port;
            _machineAndPort = machineAndPort;
        } // RemoteConnection
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        { 
            _socketCache = socketCache; 

            _cachedSocketList = new CachedSocketList(socketCache.SocketTimeout, 
                                                                        socketCache.CachePolicy);

            // parse "machinename:port", add a dummy scheme to get uri parsing
            _uri = new Uri("dummy://" + machineAndPort); 

            _port = _uri.Port; 
            _machineAndPort = machineAndPort; 

        } // RemoteConnection 
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        {
            _socketCache = socketCache;

            _cachedSocketList = new CachedSocketList(socketCache.SocketTimeout, 
                                                                        socketCache.CachePolicy);

            // parse "machinename:port", add a dummy scheme to get uri parsing
            Uri uri = new Uri("dummy://" + machineAndPort);
            string machineName = uri.Host;
            _port = uri.Port;
        
            _machineAndPort = machineAndPort;

            _addressList = Dns.GetHostAddresses(machineName);
            connectIPv6 = Socket.OSSupportsIPv6 && HasIPv6Address(_addressList);
        } // RemoteConnection
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        {
            _socketCache = socketCache;

            _cachedSocketList = new CachedSocketList(socketCache.SocketTimeout,
                                                     socketCache.CachePolicy);

            // parse "machinename:port", add a dummy scheme to get uri parsing
            Uri    uri         = new Uri("dummy://" + machineAndPort);
            string machineName = uri.Host;

            _port = uri.Port;

            _machineAndPort = machineAndPort;

            _addressList = Dns.GetHostAddresses(machineName);
            connectIPv6  = Socket.OSSupportsIPv6 && HasIPv6Address(_addressList);
        } // RemoteConnection
 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;
 }
示例#10
0
        internal RemoteConnection(SocketCache socketCache, String machineAndPort)
        {
            _socketCache = socketCache;

            _cachedSocketList = new CachedSocketList();

            // parse "machinename:port"
            String[] parts       = machineAndPort.Split(colonSep);
            String   machineName = parts[0];
            int      port        = Convert.ToInt32(parts[1]);

            _machineAndPort = machineAndPort;

            IPAddress addr = null;

            // we'll just let the exception bubble up if the machineName cannot
            //   be resolved.
            IPHostEntry ipEntries = Dns.Resolve(machineName);

            addr = CoreChannel.GetMachineAddress(ipEntries, AddressFamily.InterNetwork);

            _ipEndPoint = new IPEndPoint(addr, port);
        } // RemoteConnection
        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);

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

            return new TcpClientSocketHandler(socket, machinePortAndSid, netStream, this);
        } // CreateSocketHandler
示例#13
0
 private static SocketHandler CreateSocketHandler(
     Socket socket, SocketCache socketCache, String machineAndPort)
 {
     return new TcpClientSocketHandler(socket, machineAndPort);
 } // CreateSocketHandler
 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);
 }