def test_hex(test_bbbb:str)->str:
d=b''
for i in test_bbbb.split(' '):
ia=int(i,16)
# print(ia)
mm=ia.to_bytes(1,byteorder='little', signed=False)
d=b"".join([d,mm])
# print(d)
print(d)
return d
import binascii,time
import socket
# #发送测试******************************************************************
host ='192.0.0.1'
port = 19407
client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
client.settimeout(30)
client.connect((host,port))
register_test="7E 01 00 00 1a 01 83 39 96 99 00 00 06 00 1f 00 48 43 43 43 42 42 61 6e 64 72 6f 69 64 30 00 00 00 00 76 a7 a3 00 00 84 7E"
reg=test_hex(register_test)
client.send(reg)
ddddd=client.recv(1024)
print(binascii.b2a_hex(ddddd).decode('utf-8')) #登录后收到的回应