private void ThreadedConnect(object hostAndPort)
{
string hostAddress = (string)((object[])hostAndPort)[0];
ushort port = (ushort)((object[])hostAndPort)[1];
try
{
// Create a TcpClient.
// The client requires a TcpServer that is connected
// to the same address specified by the server and port
// combination.
client = new TcpClient(hostAddress, port);
// Get a client stream for reading and writing.
// Stream stream = client.GetStream();
netStream = client.GetStream();
readWorker = new Thread(new ThreadStart(ReadAsync));
readWorker.Start();
}
catch
{
throw new NetworkException(1, "Host is invalid or not found");
}
}