Skip to content

Instantly share code, notes, and snippets.

@jjb
Last active November 12, 2021 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjb/4cb6888dcf64d2df3f9ca589cfc2d8a8 to your computer and use it in GitHub Desktop.
Save jjb/4cb6888dcf64d2df3f9ca589cfc2d8a8 to your computer and use it in GitHub Desktop.
Use ruby to test if a port is available on a host, similar to telnet foo 123
require 'socket'
Socket.tcp("example.com", 443, connect_timeout: 1).close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment