static void DoBeginConnect1(String *host, int port)
{
// Connect asynchronously to the specifed host.
TcpClient* t = new TcpClient(AddressFamily::InterNetwork);
IPAddress* remoteHost[] = Dns::ResolveToAddresses(host);
connectDone->Reset();
Console::WriteLine(S"Establishing Connection to {0}", remoteHost[0]);
t->BeginConnect(remoteHost[0], port, new AsyncCallback(0,
&ConnectCallback), t);
// Wait here until the callback processes the connection.
connectDone->WaitOne();
Console::WriteLine(S"Connection established");
}