用于通过组播方式扫描局域网中的节点信息并向节点发送指令 更多...
Public 成员函数 | |
| __init__ (self, ip="127.0.0.1", debug=False) | |
| __del__ (self) | |
| isRunningAsyscCmd (self) | |
| 是否正在运行异步指令 | |
| scan_udp (self, timeout=5) | |
| 扫描局域网内的组播数据,解析并存储节点信息 | |
| modifyNodeName (self, targetNodeId, nodeName) | |
| 改变节点名称 | |
| executeCommand (self, command, targetNodeId=0, workdir=None, fileList=None, waitResTimeout=0, output_func=None) | |
| 发送指令给指定的节点或广播给所有节点 | |
Public 属性 | |
| localIp = ip | |
| int | localNodeId = 0 |
| isDebug = debug | |
| list | nodeDataList = [] |
| bool | running = False |
| Optional[threading.Thread] | listenerThread = None |
| recMsgQueue = queue.Queue() | |
Protected 成员函数 | |
| _getMsgIndex (self) | |
| _getLocalId (self) | |
| _print (self, descs) | |
| _startThread (self) | |
| _stopThread (self) | |
| _listenLoop (self) | |
| _getUdpListenData (self, bool block=False, Optional[float] timeout=None) | |
| _createUdpSocket (self, ip, port, timeout=1) | |
| 创建UdpSocket对象 | |
| _sendMsg (self, DistSim_pb2.MsgWrapper protobufMsg, targetIp, targetPort=COMMON_SEND_PORT) | |
| 发送数据到udp | |
静态 Protected 成员函数 | |
| _getFilenameFromPath (filePath) | |
| _getFilenameWithoutExtension (filePath) | |
| _readFileAsUtf8 (filePath) | |
用于通过组播方式扫描局域网中的节点信息并向节点发送指令
|
protected |
创建UdpSocket对象
| ip | 绑定的IP |
| port | 绑定的端口 |
| timeout | socket超时,默认1秒 |
|
staticprotected |
从文件路径中提取文件名(包含扩展名)
|
staticprotected |
从文件路径中提取不带扩展名的文件名
|
protected |
从队列获取数据,供主线程调用
|
protected |
监听循环,在独立线程中运行
|
staticprotected |
以UTF-8编码读取文件内容,返回字符串
|
protected |
发送数据到udp
| protobufMsg | DistSim_pb2定义的消息对象 |
| targetIp | 发送目标的IP |
| targetPort | 发送目标节点的端口 |
|
protected |
启动监听线程
|
protected |
停止监听线程
| executeCommand | ( | self, | |
| command, | |||
| targetNodeId = 0, | |||
| workdir = None, | |||
| fileList = None, | |||
| waitResTimeout = 0, | |||
| output_func = None ) |
| isRunningAsyscCmd | ( | self | ) |
是否正在运行异步指令
通过异步回调获取是否正在运行异步指令
| modifyNodeName | ( | self, | |
| targetNodeId, | |||
| nodeName ) |
改变节点名称
| targetNodeId目标节点 | |
| nodeName | 需改变的名称 |