From 6092928225714d1c17aa49a30ff18b66696d0a66 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 6 Jan 2022 11:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- ip_sacaner/ip_sacaner.pro | 2 + ip_sacaner/ip_sacaner.pro.user | 61 +++--- ip_sacaner/ip_sacaner.pro.user.948b996 | 267 +++++++++++++++++++++++++ ip_sacaner/scan_run.cpp | 18 +- ip_sacaner/widget.cpp | 3 +- 6 files changed, 312 insertions(+), 42 deletions(-) create mode 100644 ip_sacaner/ip_sacaner.pro.user.948b996 diff --git a/.gitignore b/.gitignore index d877771..404c264 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build* debug -.vs \ No newline at end of file +.vs +*.user \ No newline at end of file diff --git a/ip_sacaner/ip_sacaner.pro b/ip_sacaner/ip_sacaner.pro index 1f9b062..dbd3bee 100644 --- a/ip_sacaner/ip_sacaner.pro +++ b/ip_sacaner/ip_sacaner.pro @@ -24,3 +24,5 @@ FORMS += \ qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target + +#QMAKE_LFLAGS += "/STACK:65536,4096" diff --git a/ip_sacaner/ip_sacaner.pro.user b/ip_sacaner/ip_sacaner.pro.user index 4cfd186..955c388 100644 --- a/ip_sacaner/ip_sacaner.pro.user +++ b/ip_sacaner/ip_sacaner.pro.user @@ -1,14 +1,14 @@ - + EnvironmentId - {948b996b-b06e-44d3-a8b0-300fbbde1481} + {6abde24b-4ceb-4889-a962-45c24ecb0df8} ProjectExplorer.Project.ActiveTarget - 0 + 0 ProjectExplorer.Project.EditorSettings @@ -28,7 +28,7 @@ QmlJSGlobal - 2 + 2 UTF-8 false 4 @@ -79,7 +79,7 @@ true true Builtin.DefaultTidyAndClazy - 8 + 2 @@ -91,16 +91,16 @@ ProjectExplorer.Project.Target.0 Desktop - Desktop Qt 6.2.2 MinGW 64-bit - Desktop Qt 6.2.2 MinGW 64-bit - qt.qt6.622.win64_mingw_kit - 0 - 0 - 0 + Desktop Qt 5.12.12 MinGW 64-bit + Desktop Qt 5.12.12 MinGW 64-bit + qt.qt5.51212.win64_mingw73_kit + 0 + 0 + 0 0 - C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Debug - C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Debug + C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Debug + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Debug true @@ -112,7 +112,7 @@ true Qt4ProjectManager.MakeStep - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -123,7 +123,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -131,15 +131,14 @@ 2 false - false Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Release - C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Release + C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Release + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Release true @@ -151,7 +150,7 @@ true Qt4ProjectManager.MakeStep - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -162,7 +161,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -170,7 +169,6 @@ 2 false - false Release Qt4ProjectManager.Qt4BuildConfiguration @@ -179,8 +177,8 @@ 0 - C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Profile - C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Profile + C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Profile + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Profile true @@ -192,7 +190,7 @@ true Qt4ProjectManager.MakeStep - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -203,7 +201,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -211,7 +209,6 @@ 2 false - false Profile Qt4ProjectManager.Qt4BuildConfiguration @@ -219,10 +216,10 @@ 0 0 - 3 + 3 - 0 + 0 Deploy Deploy ProjectExplorer.BuildSteps.Deploy @@ -232,7 +229,7 @@ false ProjectExplorer.DefaultDeployConfiguration - 1 + 1 true true @@ -247,14 +244,14 @@ true false true - C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Debug + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_5_12_12_MinGW_64_bit-Debug - 1 + 1 ProjectExplorer.Project.TargetCount - 1 + 1 ProjectExplorer.Project.Updater.FileVersion diff --git a/ip_sacaner/ip_sacaner.pro.user.948b996 b/ip_sacaner/ip_sacaner.pro.user.948b996 new file mode 100644 index 0000000..4cfd186 --- /dev/null +++ b/ip_sacaner/ip_sacaner.pro.user.948b996 @@ -0,0 +1,267 @@ + + + + + + EnvironmentId + {948b996b-b06e-44d3-a8b0-300fbbde1481} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + -fno-delayed-template-parsing + + true + Builtin.BuildSystem + + true + true + Builtin.DefaultTidyAndClazy + 8 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop Qt 6.2.2 MinGW 64-bit + Desktop Qt 6.2.2 MinGW 64-bit + qt.qt6.622.win64_mingw_kit + 0 + 0 + 0 + + 0 + C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Debug + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Release + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + C:\Users\wuwen\Desktop\tcp_ip_scan\build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Profile + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/wuwen/Desktop/tcp_ip_scan/ip_sacaner/ip_sacaner.pro + C:/Users/wuwen/Desktop/tcp_ip_scan/ip_sacaner/ip_sacaner.pro + false + true + true + false + true + C:/Users/wuwen/Desktop/tcp_ip_scan/build-ip_sacaner-Desktop_Qt_6_2_2_MinGW_64_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/ip_sacaner/scan_run.cpp b/ip_sacaner/scan_run.cpp index be12005..20ccde9 100644 --- a/ip_sacaner/scan_run.cpp +++ b/ip_sacaner/scan_run.cpp @@ -35,23 +35,25 @@ void trytry::run() if (m_socket.waitForConnected(timeout)) { while(*outputbusy); - *outputbusy=1; + *outputbusy+=1; QString temp = QString("%1:%2").arg(ipstr).arg(ipint); output_list->append(temp); //msleep(1); - *outputbusy=0; + *outputbusy-=1; } m_socket.disconnectFromHost(); m_socket.disconnect(); - //qDebug()<<*nt_bar<<"/"<<*t_bar; - while(*barbusy); - *barbusy=1; - *now_thread_num-=1; + + //while(*barbusy); + //*barbusy+=1; *nt_bar+=1; //str.asprintf("停止 %.3f",((0.0+*nt_bar)/(0.0+*t_bar))*100); - bt->setText(QString("%1%").arg(((0.0+*nt_bar)/(0.0+*t_bar))*100)); - *barbusy=0; + //bt->setText(QString("%1%").arg(((0.0+*nt_bar)/(0.0+*t_bar))*100)); + qDebug()<<*nt_bar<<"/"<<*t_bar; + //*barbusy-=1; + + *now_thread_num-=1; } dispatch::dispatch() diff --git a/ip_sacaner/widget.cpp b/ip_sacaner/widget.cpp index 6e76941..bdd8e50 100644 --- a/ip_sacaner/widget.cpp +++ b/ip_sacaner/widget.cpp @@ -59,13 +59,14 @@ Widget::Widget(QWidget *parent) dispatch_thread->start(); connect(dispatch_thread, &dispatch::finished, [=]() { + qDebug() << "dispatch_finish"; ui->IP_list->setReadOnly(false); ui->port_list->setReadOnly(false); ui->timeout->setReadOnly(false); ui->threads->setReadOnly(false); ui->stard_scan->setText("开始扫描"); scan_flag=0; - qDebug() << "dispatch_finish"; + disconnect(dispatch_thread); //delete dispatch_thread; });