27 lines
590 B
C#
27 lines
590 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SocketStudyTest
|
|
{
|
|
public class SocketTest
|
|
{
|
|
[Fact]
|
|
public void Test()
|
|
{
|
|
var hostName = Dns.GetHostName();
|
|
var ipaddressList = Dns.GetHostAddresses(hostName,AddressFamily.InterNetwork);
|
|
|
|
var first = ipaddressList.FirstOrDefault(ip => ip.ToString().StartsWith("192"));
|
|
if (first !=null)
|
|
{
|
|
|
|
}
|
|
|
|
var dd = IPAddress.Any.ToString();
|
|
}
|
|
}
|
|
}
|