Created
April 13, 2021 08:40
-
-
Save giorgiberia/814fdc99586f6133c85148aa3f013b1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
a_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
port = 9000 | |
location = ("127.0.0.1", port) | |
result_of_check = a_socket.connect_ex(location) | |
print(str(port)+" open" if result_of_check == 0 else str(port)+" not open") | |
a_socket.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment