public ServiceStatus CheckTCPService(TCPService Service)
{
var serviceStatus = new ServiceStatus()
{
Name = Service.Name,
Type = Service.Type,
};
try
{
var client = new TcpClient(Service.Host, Convert.ToInt32(Service.Port));
serviceStatus.Status = client.Connected ? "ON" : "OFF";
}
catch (Exception)
{
serviceStatus.Status = "OFF";
}
return serviceStatus;
}