Through the forum, I found that 'uos.dupterm()' seems to help me 。
Here is my code:
Code: Select all
import pyb
import network
import uos
nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
nic.ifconfig(('192.168.1.40', '255.255.255.0', '192.168.1.18', '8.8.8.8'))
print(nic.ifconfig())
import usocket as socket
addr = socket.getaddrinfo('192.168.1.18', 6000)[0][-1]
s = socket.socket()
s.connect(addr)
s.send(b'HELLO WORLD\r\n')
uos.dupterm(s)
Code: Select all
MicroPython v1.9.3 on 2018-03-19; PYBv1.0 with STM32F405RG
dupterm: Exception in write() method, deactivating: AttributeError: 'socket' object has no attribute 'write'
I'm sorry I have very poor English