   Check if a host machine is online - C++ Sockets
  Im doing a work for college in which I have to port scan a range of machines from a given network address. Program receives a network address and mask [done]Gets the ip of the machines in that network [done]Checks which machines are onlineScans all the ports of each machine and gets which ports are open [done]My teacher apparently said something about certain ports that should be open no matter what, and that we should use those ports to see if the machine is online.But well, to be honest, I missed that class, lmao.But thats not the point.I would like to know if anyone can point me a way of checking if a host machine is connected, online, turned on, you name it. I use connect() to see if a certain port is open on a machine, but how can I know if a machine is turned on, I cant say that a machine is offline just because all ports are closed right?Im using sockets and C++.   
  Your not going to be able to confirm if a PC is online if there is a firewall blocking the connection unless the firewall fires a refused connection, as opposed to dropping the packets being sent to it.If the connection times out, assume the destination is offline.If the connection is refused, assume the destination is online, but not listening on that port.If the connection is successful, well the destination is online, and accepting connections.This may vary based on what ports you are using, and the default behavior of the destination.   ;  Best chance would be to ping it.  Firewalls and routers can block everything, if they feel like it.   