def tcp_close(self):
     """
     功能函数,关闭网络连接的方法
     기능 기능, 네트워크 연결 종료 방법
     :return:
     """
     if self.comboBox_tcp.currentIndex() == 0:
         try:
             for client, address in self.client_socket_list:
                 client.close()
             self.tcp_socket.close()
             if self.link is True:
                 # msg = '已断开网络\n'
                 msg = 'Network disconnected\n'
                 self.signal_write_msg.emit(msg)
         except Exception as ret:
             pass
     if self.comboBox_tcp.currentIndex() == 1:
         try:
             self.tcp_socket.close()
             if self.link is True:
                 # msg = '已断开网络\n'
                 msg = 'Network disconnected\n'
                 self.signal_write_msg.emit(msg)
         except Exception as ret:
             pass
     try:
         stopThreading.stop_thread(self.sever_th)
     except Exception:
         pass
     try:
         stopThreading.stop_thread(self.client_th)
     except Exception:
         pass
Exemple #2
0
 def udp_close(self):
     """
     功能函数,关闭网络连接的方法
     :return:
     """
     if self.comboBox_tcp.currentIndex() == 2:
         try:
             self.udp_socket.close()
             if self.link is True:
                 msg = '已断开网络\n'
                 self.signal_write_msg.emit(msg)
         except Exception as ret:
             pass
     if self.comboBox_tcp.currentIndex() == 3:
         try:
             self.udp_socket.close()
             if self.link is True:
                 msg = '已断开网络\n'
                 self.signal_write_msg.emit(msg)
         except Exception as ret:
             pass
     try:
         stopThreading.stop_thread(self.sever_th)
     except Exception:
         pass
     try:
         stopThreading.stop_thread(self.client_th)
     except Exception:
         pass
Exemple #3
0
 def tcp_close(self):
     #关闭网络连接的方法
     if self.Model_comboBox.currentIndex() == 0:
         try:
             for client, address in self.client_socket_list:
                 client.close()
                 if self.link is True:
                     msg = '已断开网络\n'
                     self.singnal_write_msg.emit(msg)
         except Exception as ret:
             pass
         if self.Model_comboBox.currentIndex() == 1:
             try:
                 self.tcp_socket.close()
                 if self.link is True:
                     msg = '已断开网络\n'
                     self.signal_write_msg.emit(msg)
             except Exception as ret:
                 pass
         try:
             stopThreading.stop_thread(self.server_th)
         except Exception:
             pass
         try:
             stopThreading.stop_thread(self.client_th)
         except Exception:
             pass
Exemple #4
0
 def on_stopPB_clicked(self):
     try:
         stopThreading.stop_thread(self.client_th)
     except:
         pass
     else:
         self.client_th = None
         self.recPB.setEnabled(True)
         self.stopPB.setEnabled(False)
         self.trigModCB.setEnabled(True)
 def udp_close(self):
     try:
         if self.link is True:
             msg = 'Disconnected from the network\n'
             self.signal_update.emit(msg)
     except Exception as ret:
         pass
     try:
         stopThreading.stop_thread(self.sever_thread)
     except Exception:
         pass
Exemple #6
0
 def udp_close(self):
     """
     关闭网络连接
     """
     self.udp_socket.close()
     try:
         stopThreading.stop_thread(self.sever_th)
     except Exception:
         pass
     try:
         stopThreading.stop_thread(self.client_th)
     except Exception:
         pass
     self.show_status_label.setText("断开成功")
Exemple #7
0
def dislinkClicked_UDP(winsocket, boardip):
    try:
        winsocket.close()
        boardip_winudpsocket.pop(boardip)
        msg = '已断开网络\n'
        win.signal_write_msg.emit(msg,boardip)
    except Exception as ret:
        pass
    try:
        sever_th=board_severthudp[boardip]
        stopThreading.stop_thread(sever_th)
        board_severthudp.pop(boardip)
    except Exception:
        pass
Exemple #8
0
 def text_udp_close_all(self):
     """
     功能函数,关闭网络连接的方法
     :return:
     """
     try:
         self.udp_receive_socket_text.close()
         time.sleep(0.1)
     except Exception as ret:
         pass
     try:
         stopThreading.stop_thread(self.text_sever_th)
     except Exception:
         pass
     print("text 已断开网络\n")
Exemple #9
0
 def socket_close_u(self):
     '''
     关闭udpsocket以及其相关线程
     :return:
     '''
     try:
         self.us.close()
         self.working = False
         self.open_btn.setEnabled(True)
         print('UDP closed...')
         self.open_btn.setEnabled(True)
     except Exception as ret:
         pass
     try:
         stopThreading.stop_thread(self.us_th)
     except Exception as ret:
         pass
Exemple #10
0
    def socket_close(self):
        """
        关闭TCP网络的方法
        :return:
        """
        self.clients_list.clear()
        # 当软件工作在TCPServer模式下
        self.prot_box.setEnabled(1)  #使通信协议下拉框重新可选
        if self.prot_box.currentIndex() == 0:
            try:
                for client, address in self.client_socket_list:
                    # 关闭所有的conn
                    client.close()
                    # 从conn连接列表中移除每个conn,以防下次进入监听状态时conn列表不为空,影响data_send_t按钮的判断,
                    self.client_socket_list.remove((client, address))
                self.s.close()  # 关闭套接字
                self.working = False
                self.open_btn.setEnabled(True)
                print('server closed...')
            except Exception as ret:
                pass
        # 当软件工作在TCPClient模式下
        if self.prot_box.currentIndex() == 1:
            try:
                self.s.close()
                self.working = False
                self.open_btn.setEnabled(True)
                print('TCP connection closed...')
            except Exception as ret:
                pass

        try:
            # 关闭线程
            stopThreading.stop_thread(self.s_th)
            self.link = False
        except Exception:
            pass
        try:
            # 关闭线程
            stopThreading.stop_thread(self.client_th)
            self.link = False
        except Exception:
            pass
Exemple #11
0
 def testdata_udp_close_all(self):
     """
     功能函数,关闭网络连接的方法
     :return:
     """
     try:
         self.udp_receive_socket_test_data.close()
     except Exception as ret:
         pass
     try:
         stopThreading.stop_thread(self.test_data_sever_th)
     except Exception:
         pass
     try:
         stopThreading.stop_thread(self.count_th)
     except Exception:
         pass
     self.testdata_udp_client_stop()
     print("testdata 已断开网络\n")
Exemple #12
0
def dislinkClicked_TCP(tcpsocket, winsocket, boardip):
    try:
        winsocket.close()
        boardip_winsocket.pop(boardip)
        tcpsocket.shutdown(2)
        tcpsocket.close()
        boardip_tcpsocket.pop(boardip)
        client_address=tcpsocket_addr[tcpsocket]
        win.client_socket_list.remove((tcpsocket, client_address))
        tcpsocket_addr.pop(tcpsocket)
        msg = '已断开网络\n'
        win.signal_write_msg.emit(msg, boardip)
        tabindex_ip.pop(boardip)
    except Exception as ret:
        pass
    try:
        sever_th=board_severthtcp[boardip]
        stopThreading.stop_thread(sever_th)
        board_severthtcp.pop(boardip)
    except Exception as ret:
        pass
 def web_close(self):
     """
     功能函数,关闭网络连接的方法
     :return:
     """
     try:
         for client, address in self.client_socket_list:
             client.close()
         self.tcp_socket.close()
         if self.link is True:
             msg = '已断开网络\n'
             self.signal_write_msg.emit(msg)
     except Exception as ret:
         pass
     try:
         stopThreading.stop_thread(self.sever_th)
     except Exception:
         pass
     try:
         stopThreading.stop_thread(self.client_th)
     except Exception:
         pass