Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to check if a network port is open

import socket 

def port_check(HOST):
   s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   s.settimeout(2) #Timeout in case of port not open
   try:
      s.connect((HOST, 22)) #Port ,Here 22 is port 
      return True
   except:
      return False

port_check("127.0.1.1")
Comment

PREVIOUS NEXT
Code Example
Python :: matplotlib plot data 
Python :: find position of nan pandas 
Python :: list map lambda python 
Python :: print(np.round(df.isnull().sum() / len(df), 2)) 
Python :: how to replace nan with 0 in pandas 
Python :: py random list integers 
Python :: tkinter window title 
Python :: python read excel set index 
Python :: pyplot set x range 
Python :: pandas split column into multiple columns by delimiter 
Python :: replace nan in pandas 
Python :: sqlite3 like python 
Python :: regex to find ip address python 
Python :: Python Enemy NPC CLass 
Python :: Simulate webcam and microphone selenium 
Python :: colorized progress bar python in console 
Python :: import pandas 
Python :: pandas rename columns by position 
Python :: change name of column pandas 
Python :: converting a string to a dictionary in python 
Python :: cv_bridge.core.CvBridgeError: [8UC4] is not a color format. but [bgr8] is. The conversion does not make sense 
Python :: Filler values must be provided when X has more than 2 training features 
Python :: media url django 
Python :: string list into list pandas 
Python :: open an exe file using python 
Python :: sdsdsdsdsddsdddsdsdsdsdsdsdsdsdsdsdsdsdsdssdsdsdsdsdsdsdssssssddsdssdssssdsdsdsdsdsdsdsdsdsdsdsdsdsdssdssdsdsdsdsdsdsdsdsdsdsdssd 
Python :: python pandas reading pickelt 
Python :: dataframe plot distribution of dates 
Python :: date format in django template 
Python :: get the center of a blob opencv 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =