Python
- 1 ответ
- 0 вопросов
1
Вклад в тег
def connectToServer ():
....
except:
print("error occured")
ServerSock.close()
time.sleep(5)
connectToServer()
def connectToServer ():
print("Server: connecting")
global ServerSock
connected = False
while not connected:
try:
ServerSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ServerSock.settimeout(10)
ServerSock.connect((ServerHost, ServerPort))
ServerSock.settimeout(10)
print("Server: connected")
connected = True
except:
print("error occured")
ServerSock.close()
time.sleep(5)