C# 利用tcpclient來測試主機是否存在 非ping
4: /// <returns>true:存在;false:不存在</returns>
public bool ByTcpIp()
{
IPEndPoint tIPEndPoint = new IPEndPoint(IPAddress.Parse(IPv4Address), Port);
TcpClient tClient = new TcpClient();
tClient.Connect(tIPEndPoint);
bool tResult = tClient.Connected;
tClient.Close();
return tResult;
}