Initial commit
This commit is contained in:
commit
ccd9753276
3 changed files with 55 additions and 0 deletions
16
demo.py
Normal file
16
demo.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import network, sys, time
|
||||
|
||||
sock = network.Sock()
|
||||
|
||||
port = int(sys.argv[2])
|
||||
|
||||
if sys.argv[1] == "s":
|
||||
sock.listen(("0.0.0.0", port))
|
||||
while True:
|
||||
for (d, a) in sock.poll():
|
||||
print(d, a)
|
||||
time.sleep(0.1)
|
||||
elif sys.argv[1] == "c":
|
||||
while True:
|
||||
sock.send(str(time.time()), (sys.argv[3], port))
|
||||
time.sleep(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue