public void Connect(string hostName, int port) { Disconnect(); this.hostName = hostName; this.port = port; UpdateState(SocketState.Resolving); Resolve resolve = Dns.GetHostEntry; resolve.BeginInvoke(hostName, ResolveCallback, resolve); }