反编译System.dll得到:public void Connect(string hostname, int port) { IPAddress address1; int num1; if (this.m_CleanedUp) { throw new ObjectDisposedException(base.GetType().FullName); } if (hostname == null) { throw new ArgumentNullException("hostname"); } if (!ValidationHelper.ValidateTcpPort(port)) { throw new ArgumentOutOfRangeException("port"); } if (this.m_Active) { throw new SocketException(10056); } IPHostEntry entry1 = Dns.Resolve(hostname); ...
速度应该是相当,嗯
static int port = 1000;
上面
client.Connect(host,port);并没有使用Dns.Resolve还是IPAddress.Parse。就这个Connect慢。大家都怎么用的?
{
IPAddress address1;
int num1;
if (this.m_CleanedUp)
{
throw new ObjectDisposedException(base.GetType().FullName);
}
if (hostname == null)
{
throw new ArgumentNullException("hostname");
}
if (!ValidationHelper.ValidateTcpPort(port))
{
throw new ArgumentOutOfRangeException("port");
}
if (this.m_Active)
{
throw new SocketException(10056);
}
IPHostEntry entry1 = Dns.Resolve(hostname);
...
http://www.aisto.com/roeder/dotnet