I need a quick way to find out if a given port is open with Ruby. I currently am fiddling around with this:
require \'socket\' def is_port_open?(ip, port)
I recently came up with this solution, making use of the unix lsof command:
lsof
def port_open?(port) !system("lsof -i:#{port}", out: '/dev/null') end