GetMachineAddress() static private method

static private GetMachineAddress ( IPHostEntry host, AddressFamily addressFamily ) : IPAddress
host System.Net.IPHostEntry
addressFamily AddressFamily
return System.Net.IPAddress
Beispiel #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);

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

            _ipEndPoint = new IPEndPoint(addr, port);
        } // RemoteConnection