19 lines
438 B
Python
19 lines
438 B
Python
import socket;
|
|
|
|
url = camtool.getInstance(camtool.getInstances()[0])["stream"]
|
|
|
|
srv = url[6:url.rfind(":")]
|
|
port = int(url[url.rfind(":")+1:])
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
result = sock.connect_ex((srv,port))
|
|
|
|
if result == 0:
|
|
print "Port is open"
|
|
elif result == 106:
|
|
print "Port is connected"
|
|
elif result == 111:
|
|
print "Port is not open"
|
|
elif result == 111:
|
|
print "Error " + result
|
|
sock.close() |