Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

socket python how to check if server alive

import socket
s = socket.socket(
    socket.AF_INET, socket.SOCK_STREAM)
try:
    s.connect(("localhost", 10000))
except socket.error as e:
    print e
OUTPUT
[Errno 111] Connection refused
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #socket #python #check #server #alive
ADD COMMENT
Topic
Name
8+6 =