串口小工具(来源网络,源码修改)

news2024/7/6 17:46:27

从CSDN 中的一位博主的分享做了一些修改

QtSerial 的配和更稳定些

信号和槽 … … 更不容易崩

# This Python file uses the following encoding: utf-8
import sys
import time

from PySide6.QtGui import QIcon, QTextCursor
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QMessageBox
from PySide6.QtCore import QTimer, QThread
# Important:
# You need to run the following command to generate the ui_form.py file
#     pyside6-uic form.ui -o ui_form.py, or
#     pyside2-uic form.ui -o ui_form.py
from ui_form import Ui_MainWindow
import PySide6.QtSerialPort as serial
import PySide6.QtCore as QtCore


class MainWindow(QMainWindow, Ui_MainWindow):
    _recvThread = None
    portSelect = None
    bitSize = serial.QSerialPort.DataBits.Data8

    def __init__(self, parent=None):
        super().__init__(parent)
        self.portDict = None
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.setWindowTitle('串口小工具')

        self.mSerial = serial.QSerialPort()
        self.ScanComPort()  # 扫描一次串口端口
        self.OnPortChanged()

        self.ui.comboBox_Baudrate.setCurrentText("115200")  # 设置默认波特率
        self.ui.comboBox_ByteSize.setCurrentText("8")  # 设置默认数据位

        self.ui.BtnScanPort.clicked.connect(self.ScanComPort)
        self.ui.BtnOpenPort.clicked.connect(self.OpenComPort)
        self.ui.BtnClosePort.clicked.connect(self.CloseComPort)
        self.ui.BtnSendData.clicked.connect(self.SendData)
        self.ui.BtnClearRecv.clicked.connect(self.ClearRecvText)
        self.ui.BtnClearSend.clicked.connect(self.ClearSendText)
        self.ui.comboBox_ComPort.currentIndexChanged.connect(self.OnPortChanged)

    def ClearRecvText(self):
        self.ui.textBrowserRecvArea.clear()

    def ClearSendText(self):
        self.ui.lineEdit_SendData.clear()

    def OnPortChanged(self):
        if len(self.portDict) > 0:
            self.ui.label_CurrentPortName.setText(self.portDict[self.ui.comboBox_ComPort.currentText()])

    def ScanComPort(self):
        self.portDict = {}
        self.portSelect = {}
        self.ui.comboBox_ComPort.clear()
        portList = serial.QSerialPortInfo.availablePorts()
        for port in portList:
            self.portDict["%s" % port.portName()] = "%s" % port.description()
            self.portSelect["%s" % port.portName()] = port
            self.ui.comboBox_ComPort.addItem(port.portName())
        if len(self.portDict) == 0:
            QMessageBox.critical(self, "警告", "未找到串口", QMessageBox.StandardButton.Cancel,
                                 QMessageBox.StandardButton.Cancel)
        pass

    def OpenComPort(self):
        port = self.ui.comboBox_ComPort.currentText()
        self.mSerial.setPort(self.portSelect[port])
        baudrate = int(self.ui.comboBox_Baudrate.currentText())
        self.mSerial.setBaudRate(baudrate)

        # 数据位设置
        bytesize = self.ui.comboBox_ByteSize.currentText()
        if "5" == bytesize:
            bitSize = serial.QSerialPort.DataBits.Data5
        elif "6" == bytesize:
            bitSize = serial.QSerialPort.DataBits.Data6
        elif "7" == bytesize:
            bitSize = serial.QSerialPort.DataBits.Data7
        elif "8" == bytesize:
            bitSize = serial.QSerialPort.DataBits.Data8
        self.mSerial.setDataBits(bitSize)

        stopbitsItems = [serial.QSerialPort.StopBits.OneStop, serial.QSerialPort.StopBits.OneAndHalfStop,
                         serial.QSerialPort.StopBits.TwoStop]
        stopbits = stopbitsItems[self.ui.comboBox_Stopbits.currentIndex()]
        self.mSerial.setStopBits(stopbits)

        parityItmes = [serial.QSerialPort.Parity.NoParity,
                       serial.QSerialPort.Parity.OddParity,
                       serial.QSerialPort.Parity.EvenParity,
                       serial.QSerialPort.Parity.MarkParity,
                       serial.QSerialPort.Parity.SpaceParity,
                       serial.QSerialPort.Parity.NoParity]
        self.mSerial.setParity(parityItmes[self.ui.comboBox_Parity.currentIndex()])

        flowctrl = self.ui.comboBox_FlowCtrl.currentText()
        if 'None' == flowctrl:
            self.mSerial.setFlowControl(serial.QSerialPort.FlowControl.NoFlowControl)
        elif 'XON/XOFF' == flowctrl:
            self.mSerial.setFlowControl(serial.QSerialPort.FlowControl.SoftwareControl)
        elif 'RTS/CTS' == flowctrl:
            self.mSerial.setFlowControl(serial.QSerialPort.FlowControl.HardwareControl)

        self.mSerial.timeout = 100
        if self.mSerial.isOpen():
            QMessageBox.warning(self, "警告", "串口已打开", QMessageBox.StandardButton.Cancel,
                                QMessageBox.StandardButton.Cancel)

        else:
            try:
                self.ui.BtnOpenPort.setEnabled(False)
                self.mSerial.open(QtCore.QIODeviceBase.OpenModeFlag.ReadWrite)
                self.mSerial.flush()
                self._recvThread = QThread(self)
                self._recvThread.run = self.RecvData
                self._recvThread.start()
            except SerialException as error:
                QMessageBox.critical(self, "警告", "串口打开失败:%s" % error.strerror,
                                     QMessageBox.StandardButton.Cancel,
                                     QMessageBox.StandardButton.Cancel)
                self.ui.BtnOpenPort.setEnabled(True)

        self.mSerial.readyRead.connect(self.RecvData)

    def CloseComPort(self):
        if self._recvThread is not None:
            if self._recvThread.isRunning():
                self._recvThread.exit(1)
        if self.mSerial.isOpen():
            self.ui.BtnOpenPort.setEnabled(True)
            self.mSerial.flush()
            self.mSerial.close()
        pass

    def SendData(self):
        if self.mSerial.isOpen():
            if self.mSerial.isWritable():
                sendtext = self.ui.lineEdit_SendData.text() + "\r"
                self.mSerial.write(sendtext.encode("utf-8"))
        else:
            QMessageBox.warning(self, "警告", "串口未打开,请先打开串口", QMessageBox.StandardButton.Cancel,
                                QMessageBox.StandardButton.Cancel)

    def refreshConsole(self):
        self.ui.textBrowserRecvArea.moveCursor(QTextCursor.MoveOperation.End)

    def RecvData(self):
        rdata = self.mSerial.readAll()
        self.ui.textBrowserRecvArea.append(rdata.data().decode("utf-8").strip("\n"))
        self.refreshConsole()



if __name__ == '__main__':
    app = QApplication(sys.argv)
    mw = MainWindow()
    mw.show()
    sys.exit(app.exec())

ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1439</width>
    <height>713</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QGroupBox" name="groupBox_ComSettings">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>20</y>
      <width>221</width>
      <height>471</height>
     </rect>
    </property>
    <property name="title">
     <string>串口设置</string>
    </property>
    <widget class="QWidget" name="horizontalLayoutWidget">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>400</y>
       <width>201</width>
       <height>51</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QPushButton" name="BtnOpenPort">
        <property name="text">
         <string>打开串口</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="BtnClosePort">
        <property name="text">
         <string>关闭串口</string>
        </property>
       </widget>
      </item>
     </layout>
    </widget>
    <widget class="QWidget" name="horizontalLayoutWidget_2">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>350</y>
       <width>201</width>
       <height>51</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout_8">
      <item>
       <widget class="QPushButton" name="BtnScanPort">
        <property name="text">
         <string>扫描端口</string>
        </property>
       </widget>
      </item>
     </layout>
    </widget>
    <widget class="QLabel" name="label_CurrentPortName">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
       <width>201</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string/>
     </property>
    </widget>
    <widget class="QWidget" name="layoutWidget">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>60</y>
       <width>201</width>
       <height>281</height>
      </rect>
     </property>
     <layout class="QVBoxLayout" name="verticalLayout">
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_2">
        <item>
         <widget class="QLabel" name="label_ComPort">
          <property name="maximumSize">
           <size>
            <width>60</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="text">
           <string>串  口</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QComboBox" name="comboBox_ComPort">
          <property name="editable">
           <bool>false</bool>
          </property>
         </widget>
        </item>
       </layout>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_3">
        <item>
         <widget class="QLabel" name="label_Baudrate">
          <property name="maximumSize">
           <size>
            <width>60</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="text">
           <string>波特率</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QComboBox" name="comboBox_Baudrate">
          <property name="editable">
           <bool>true</bool>
          </property>
          <property name="currentText">
           <string>115200</string>
          </property>
          <property name="currentIndex">
           <number>8</number>
          </property>
          <item>
           <property name="text">
            <string>2400</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>4800</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>9600</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>14400</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>19200</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>38400</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>56000</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>57600</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>115200</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>128000</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>256000</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>230400</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>1000000</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>2000000</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>3000000</string>
           </property>
          </item>
         </widget>
        </item>
       </layout>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_4">
        <item>
         <widget class="QLabel" name="label_ByteSize">
          <property name="maximumSize">
           <size>
            <width>60</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="text">
           <string>数据位</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QComboBox" name="comboBox_ByteSize">
          <property name="editable">
           <bool>false</bool>
          </property>
          <property name="currentText">
           <string>8</string>
          </property>
          <property name="currentIndex">
           <number>3</number>
          </property>
          <item>
           <property name="text">
            <string>5</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>6</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>7</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>8</string>
           </property>
          </item>
         </widget>
        </item>
       </layout>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_6">
        <item>
         <widget class="QLabel" name="label_Stopbits">
          <property name="maximumSize">
           <size>
            <width>60</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="text">
           <string>停止位</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QComboBox" name="comboBox_Stopbits">
          <item>
           <property name="text">
            <string>1</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>1.5</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>2</string>
           </property>
          </item>
         </widget>
        </item>
       </layout>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_5">
        <item>
         <widget class="QLabel" name="label_Parity">
          <property name="maximumSize">
           <size>
            <width>60</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="text">
           <string>校验位</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QComboBox" name="comboBox_Parity">
          <item>
           <property name="text">
            <string>None</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>Odd</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>Even</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>Mark</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>Space</string>
           </property>
          </item>
         </widget>
        </item>
       </layout>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_7">
        <item>
         <widget class="QLabel" name="label_CTS">
          <property name="maximumSize">
           <size>
            <width>60</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="text">
           <string>流  控</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QComboBox" name="comboBox_FlowCtrl">
          <item>
           <property name="text">
            <string>None</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>RTS/CTS</string>
           </property>
          </item>
          <item>
           <property name="text">
            <string>XON/XOFF</string>
           </property>
          </item>
         </widget>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </widget>
   <widget class="QGroupBox" name="groupBox">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>20</y>
      <width>1181</width>
      <height>471</height>
     </rect>
    </property>
    <property name="title">
     <string>接收区</string>
    </property>
    <widget class="QTextBrowser" name="textBrowserRecvArea">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
       <width>1161</width>
       <height>441</height>
      </rect>
     </property>
    </widget>
   </widget>
   <widget class="QGroupBox" name="groupBox_2">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>500</y>
      <width>1181</width>
      <height>151</height>
     </rect>
    </property>
    <property name="title">
     <string>发送区</string>
    </property>
    <widget class="QLineEdit" name="lineEdit_SendData">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
       <width>561</width>
       <height>31</height>
      </rect>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData">
     <property name="geometry">
      <rect>
       <x>580</x>
       <y>20</y>
       <width>181</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>发送数据</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnClearRecv">
     <property name="geometry">
      <rect>
       <x>760</x>
       <y>20</y>
       <width>171</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>清空接收区</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnClearSend">
     <property name="geometry">
      <rect>
       <x>930</x>
       <y>20</y>
       <width>171</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>清空发送区</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData_2">
     <property name="geometry">
      <rect>
       <x>930</x>
       <y>60</y>
       <width>171</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>循环执行脚本</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData_3">
     <property name="geometry">
      <rect>
       <x>760</x>
       <y>60</y>
       <width>171</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>导入命令脚本</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData_4">
     <property name="geometry">
      <rect>
       <x>580</x>
       <y>60</y>
       <width>181</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>执行命令脚本</string>
     </property>
    </widget>
    <widget class="QComboBox" name="comboBox">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>100</y>
       <width>561</width>
       <height>31</height>
      </rect>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData_5">
     <property name="geometry">
      <rect>
       <x>580</x>
       <y>100</y>
       <width>181</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>变更输出解析类型</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData_6">
     <property name="geometry">
      <rect>
       <x>760</x>
       <y>100</y>
       <width>171</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>导入输出解析类型</string>
     </property>
    </widget>
    <widget class="QPushButton" name="BtnSendData_7">
     <property name="geometry">
      <rect>
       <x>930</x>
       <y>100</y>
       <width>171</width>
       <height>31</height>
      </rect>
     </property>
     <property name="text">
      <string>冻结/解冻</string>
     </property>
    </widget>
    <widget class="QComboBox" name="comboBox_2">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>60</y>
       <width>561</width>
       <height>31</height>
      </rect>
     </property>
    </widget>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>1439</width>
     <height>17</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>

在这里插入图片描述> 添加键盘监听事件

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1859931.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【PyQt5】一文向您详细介绍 layout.addWidget() 的作用

【PyQt5】一文向您详细介绍 layout.addWidget() 的作用 下滑即可查看博客内容 &#x1f308; 欢迎莅临我的个人主页 &#x1f448;这里是我静心耕耘深度学习领域、真诚分享知识与智慧的小天地&#xff01;&#x1f387; &#x1f393; 博主简介&#xff1a;985高校的普通本…

el-dialog el-select适配移动端

一、el-dialog 2024.06.20今天我学习了如何对el-dialog弹窗适配移动端展示&#xff0c;效果如下&#xff1a; 代码如下&#xff1a; media screen and (min-width: 220px) and (max-width: 600px) {::v-deep .el-dialog {width: 95% !important;} } 二、el-select 代码如下…

技术革命背后的新功能发布:探索Facebook创新

随着技术的飞速发展和社交媒体的普及&#xff0c;Facebook作为全球最大的社交平台之一&#xff0c;不断推出新的功能和服务&#xff0c;以满足用户的需求和提升用户体验。这些新功能不仅仅是技术进步的体现&#xff0c;更是Facebook在竞争激烈的数字化时代中保持领先地位的关键…

CANFD每秒最多可以发送多少帧报文?CAN FD结构详解

我们知道CANFD比CAN拥有更长的数据长度&#xff08;最长64字节&#xff09;&#xff0c;更高的波特率&#xff08;8Mbps甚至更高&#xff09;。那么波特率更高&#xff0c;数据更长的CANFD&#xff0c;一秒钟最高可以发送多少帧CANFD报文呢&#xff1f; 想知道问题的答案&#…

C++结构体内存对齐规则

背景介绍 最近在使用Java语言写一个Java客户端&#xff0c;对接一个C/C语言编写的Server时&#xff0c;采用TCP协议进行通信&#xff0c;在将C结构体序列化的输出流转换为Java结构体时&#xff0c;需要按照结构体每个字段对应的字节长度截取字节流转换为Java类型&#xff0c;遇…

2024国际数字能源展,推动全球能源产业转型升级和可持续发展

随着全球对能源安全和可持续发展的日益关注&#xff0c;数字能源技术作为推动能源革命的重要力量&#xff0c;正逐步成为国际能源领域的新热点。2023年6月29日至7月2日&#xff0c;深圳会展中心成功举办了全球首个以数字能源为主题的2023国际数字能源展&#xff0c;这一盛会的成…

ET实现游戏中邮件系统逻辑思路(服务端)

ET是一个游戏框架&#xff0c;用的编程语言是C#&#xff0c;游戏引擎是Unity&#xff0c;框架作者&#xff1a;熊猫 ET社区 在游戏中我们通常都会看到有邮件系统&#xff0c;邮件系统的作用有给玩家通知、发放奖励等 下面小编使用ET框架带大家看一下邮件系统的一种实现方…

新型基坑气膜:施工开挖的得力干将—轻空间

随着城市建设的加速推进&#xff0c;施工过程中的环境问题日益受到关注。新型基坑气膜以其卓越的防尘、降噪、节能和防火功能&#xff0c;成为施工开挖领域中的得力干将&#xff0c;极大地提升了绿色施工的水平。 基坑气膜的作用 基坑气膜在施工现场形成了一个完全封闭的作业空…

数据模型(models)

自学python如何成为大佬(目录):https://blog.csdn.net/weixin_67859959/article/details/139049996?spm1001.2014.3001.5501 &#xff08;1&#xff09;在App中添加数据模型 在app1的models.py中添加如下代码&#xff1a; from django.db import models # 引入django.…

打造智能家居:用ESP32轻松实现无线控制与环境监测

ESP32是一款集成了Wi-Fi和蓝牙功能的微控制器&#xff0c;广泛应用于物联网项目。它由Espressif Systems公司开发&#xff0c;具有强大的处理能力和丰富的外设接口。下面我们将详细介绍ESP32的基础功能和引脚功能&#xff0c;并通过具体的实例项目展示其应用。 主要功能 双核处…

YOLOv10(6):YOLOv10基于TensorRT的部署(基于INetworkDefinition)

1. 写在前面 我们在前面已经讲过很多关于YOLOv10的一些知识点&#xff0c;也简单理了一下如何训练自己的数据。 现在本篇文章主要是讲解一下如何在TensorRT中部署YOLOv10&#xff0c;相信经过这一步&#xff0c;各位小伙伴已经能够无限的接近于将YOLOv10产品化了。 另一个需要说…

qt creator在windows上配置调试器

从微软下载winsdk&#xff1a;https://developer.microsoft.com/zh-cn/windows/downloads/sdk-archive/ 运行winsdksetup.exe 选择下载 选择debugging tools for windows 选择安装x64版本debug工具 重新打开qt&#xff0c;自动选择安装的编译器

[汇总] Docker容器详解 Macvlan 创建不同容器独立跑仿真(持续更新中)

一、概念介绍 1.1 什么是macvlan macvlan是一种网卡虚拟化技术&#xff0c;能够将一张网卡&#xff08;Network Interface Card, NIC&#xff09;虚拟出多张网卡&#xff0c;这意味着每个虚拟网卡都能拥有独立的MAC地址和IP地址&#xff0c;从而在系统层面表现为完全独立的网络…

下一代广域网技术-Segment Routing(SR)

1.SR MPLS 1.1.广域网VPN技术的演进 特殊的EVPN&#xff1a;从L2VPN发展的EVPN 以VPLS为例的L2VPN存在多种问题&#xff0c;例如业务部署复杂、网络规模受限、不支持双归等&#xff0c;IETF提出EVPN来解决这些问题EVPN最初被设计为一个基于BGP扩展的L2VPN技术&#xff0c;但…

DataWhale - 吃瓜教程学习笔记(三)

学习视频&#xff1a;第3章-对数几率回归_哔哩哔哩_bilibili 西瓜书对应章节&#xff1a; 3.3 对数几率回归 sigmoid函数 极大似然估计建模 信息论 以概率论、随机过程为基本研究工具&#xff0c;研究广义通信系统的整个过程 - 信息熵 &#xff08;信息期望&#xff09; 度…

上海亚商投顾:三大指数均跌超1% 全市场下跌个股近5000只

上海亚商投顾前言&#xff1a;无惧大盘涨跌&#xff0c;解密龙虎榜资金&#xff0c;跟踪一线游资和机构资金动向&#xff0c;识别短期热点和强势个股。 一.市场情绪 三大指数昨日震荡调整&#xff0c;尾盘集体跌超1%&#xff0c;微盘股指数跌逾4%&#xff0c;黄白二线分化明显…

【Hadoop集群搭建】实验3:JDK安装及配置、Hadoop本地模式部署及测试

1. 安装 SSH 工具 SSH Secure Shell Client 传输软件 FinalShell(推荐使用) 1.1使用SSH工具将JDK安装包上传至虚拟主机hadoop01, hadoop02, hadoop03&#xff0c;sogou500w 数据上传至 hadoop01。 a. 在虚拟主机/usr 目录下创建文件夹 java&#xff0c;JDK 上传至此目录&…

昇思25天学习打卡营第1天|初学教程

文章目录 背景创建环境熟悉环境打卡记录学习总结展望未来 背景 参加了昇思的25天学习记录&#xff0c;这里给自己记录一下所学内容笔记。 创建环境 首先在平台注册账号&#xff0c;然后登录&#xff0c;按下图操作&#xff0c;创建环境即可 创建好环境后进入即可&#xff0…

死锁的条件、预防、避免、检测

死锁的条件、预防、避免、检测 死锁的必要条件 互斥条件&#xff1a;一个资源一次只能给一个进程使用&#xff0c;非共享请求与保持条件&#xff1a;保持自己资源的同时请求其他资源&#xff0c;该资源可能被占有非剥夺条件&#xff1a;不能强行夺走资源&#xff0c;只能等别的…

【10】交易-交易的结构

1. 交易的结构 1.1 引言 需要说明的是,在我们之前的例子中,区块中的交易(data)是用字符串数据来表示的,但在真正的比特币网络中,交易是一个复杂的数据结构,记录了不同地址之间的价值转移信息。在比特币系统中没有账号或身份信息的概念的,也不会记录地址和身份之间的关…