File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 44 import socket
55
66
7- CONTENT = """\
7+ CONTENT = b """\
88 HTTP/1.0 200 OK
99
10- Hello #{} from MicroPython!
10+ Hello #%d from MicroPython!
1111"""
1212
1313s = socket .socket ()
3030 print ("Client socket:" , client_s )
3131 print ("Request:" )
3232 if 0 :
33- # MicroPython rawsocket module supports file interface directly
33+ # MicroPython socket objects support stream (aka file) interface
34+ # directly.
3435 print (client_s .read (4096 ))
35- #print(client_s.readall())
36- client_s .write (CONTENT .format (counter ))
36+ client_s .write (CONTENT % counter )
3737 else :
3838 print (client_s .recv (4096 ))
39- client_s .send (bytes ( CONTENT . format ( counter ), "ascii" ) )
39+ client_s .send (CONTENT % counter )
4040 client_s .close ()
4141 counter += 1
42+ print ()
You can’t perform that action at this time.
0 commit comments