这是我的代码:
import serial
import time
import socket
ip = str('url')
port = int(6090)
err = 0
try:
mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mySocket.connect((ip, port))
while 1:
arduino = serial.Serial('/dev/ttyACM0', 9600)
sensorValue = arduino.readline()
mySocket.sendall(sensorValue)
except socket.error, msg:
mySocket.close()
print 'socket error', msg
mySocket.close
运行此程序后,我收到此消息“套接字错误 [Errno -3] 名称解析临时失败”。有人可以帮我解决这个问题吗?