例如填写115.115.115.115这种类型的没有问题
改成115AB.f3322.net就不行
应该怎么改?
.maxstack 5
.locals init (class [System]System.Net.IPEndPoint[] V_0)
IL_0000: ldc.i4.3
IL_0001: newarr [System]System.Net.IPEndPoint
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.0
IL_0009: ldstr "127.0.0.1"
IL_000e: call class [System]System.Net.IPAddress [System]System.Net.IPAddress::Parse(string)
IL_0013: ldc.i4 0xa22
IL_0018: newobj instance void [System]System.Net.IPEndPoint::.ctor(class [System]System.Net.IPAddress,
int32)
IL_001d: stelem.ref
IL_001e: ldloc.0
IL_001f: ldc.i4.1
IL_0020: ldstr "127.0.0.1"
IL_0025: call class [System]System.Net.IPAddress [System]System.Net.IPAddress::Parse(string)
IL_002a: ldc.i4 0xa22
IL_002f: newobj instance void [System]System.Net.IPEndPoint::.ctor(class [System]System.Net.IPAddress,
int32)
IL_0034: stelem.ref
IL_0035: ldloc.0
IL_0036: ldc.i4.2
IL_0037: ldstr "115AB.f3322.net"
IL_003c: call class [System]System.Net.IPAddress [System]System.Net.IPAddress::Parse(string)
IL_0041: ldc.i4 0xa22
IL_0046: newobj instance void [System]System.Net.IPEndPoint::.ctor(class [System]System.Net.IPAddress,
int32)
IL_004b: stelem.ref
IL_004c: ldloc.0
IL_004d: stsfld class [System]System.Net.IPEndPoint[] Server.SocketOptions::m_ListenerEndPoints
IL_0052: ret
} // end of method SocketOptions::.cctor
} // end of class Server.SocketOptions
System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.TypeInitializationException: “Server.SocketOptions”的类型初始值设定项引发异常。 ---> System.FormatException: 指定了无效的 IP 地址。
在 System.Net.IPAddress.InternalParse(String ipString, Boolean tryParse)
在 Server.SocketOptions..cctor()
内部异常堆栈跟踪的结尾
在 Server.SocketOptions.Initialize()
内部异常堆栈跟踪的结尾
在 System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
在 Server.ScriptCompiler.Invoke(String method)
在 Server.Core.Main(String[] args)
This exception is fatal, press return to exit
完全不会
支持域名IP
IP地址无效,域名是真实存在的域名吗。
cmd中ping 域名,看看是否连通。
用的Winsock么,ip有字母,设置不符合规矩,想要额外加上域名,应该想办法加一条DNS记录
没有,所以通常的代码为
var ips = Dns.GetHostAddresses("www.baidu.com");
var ip=ips[0];//当然如果没办法访问域名会有异常,自己处理