Beispiel #1
0
        public async Task GetIPAsync_ReturnsIpAddress(string hostName)
        {
            // Act
            IPAddress address = await EndpointUtils.GetIpAsync(hostName);

            // Assert
            Assert.NotNull(address);
            Assert.Equal(address.AddressFamily, AddressFamily.InterNetwork);
        }
Beispiel #2
0
        private IPEndPoint CreateIpEndPoint()
        {
            IPAddress address;

            if (!string.IsNullOrEmpty(Domain))
            {
                address = EndpointUtils.GetIpAsync(Domain).Result;
                Ip      = address.ToString();
            }
            else
            {
                address = IPAddress.Parse(Ip);
            }

            return(new IPEndPoint(address, Port));
        }