REX-ET60 python で接続

割り込みなしの簡易な方法で

import socket

host = “192.168.11.123”
port = 5000

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u4f5c\u6210

client.connect((host, port))

response =””

while True:
response = response + client.recv(32).decode(‘utf-8’)
if len(response ) >=15:
break

print(response)
client.close()

カテゴリー iot