python 实现仪器LAN口通信(FLUKE 8846)

# _*_ coding:utf-8 _*_

import socket
import time

HOST = '169.254.1.1' #8846 IP
PORT = 3490 #8846 PORT
BUF_SIZE = 1024
ADDR = (HOST,PORT)

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

client.connect(ADDR)


while True:


    a = client.send(b'*idn?\r\n')
    #print(a)
    print("================")
    recv_data = client.recv(BUF_SIZE)

    if not recv_data:
        break

    print(recv_data.decode())
    time.sleep(1)
      
client.close()

 

posted @ 2020-05-27 13:08  njuptlwh  阅读(1096)  评论(0编辑  收藏  举报