mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Add timeout to socket
This commit is contained in:
parent
f18b2bbc2f
commit
3ac77d05c7
@ -136,6 +136,7 @@ def ping(ip, port):
|
|||||||
return i
|
return i
|
||||||
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
sock.settimeout(5)
|
||||||
try:
|
try:
|
||||||
sock.connect((ip, port))
|
sock.connect((ip, port))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user