From 13708434c91936c18910a6315f1b8f0922b1a1d0 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Mon, 29 Jan 2024 19:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Host/mainwindow.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Host/mainwindow.py diff --git a/.gitignore b/.gitignore index 49ff8fb..4cb11cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.user* +.qmake.stash __pycache__ diff --git a/Host/mainwindow.py b/Host/mainwindow.py new file mode 100644 index 0000000..0f7865f --- /dev/null +++ b/Host/mainwindow.py @@ -0,0 +1,22 @@ +import time +import socket +import traceback +while True: + try: + s = socket.socket() + s.connect(("127.0.0.1", 8080)) + info = "Apple".encode("utf-8") + len = s.send(info) + ret = s.recv(1024) + if info == ret: + print("success") + break + except: + traceback.print_exc() + time.sleep(0.1) +exit() +while True: + + if not ret: + s.close() +