Skip to content

Instantly share code, notes, and snippets.

@theboshy
Created April 19, 2018 20:23
Show Gist options
  • Save theboshy/db345ebbcf22612f940300e5648d226b to your computer and use it in GitHub Desktop.
Save theboshy/db345ebbcf22612f940300e5648d226b to your computer and use it in GitHub Desktop.
Permite verificar si un puerto se encuentra disponible
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex(('127.0.0.1',3000))
if result == 0:
print "Port is open"
else:
print "Port is not open"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment