jsb-netgame/demo.py
ZettaScript 2863035228 Game
2024-02-03 18:57:23 +01:00

16 lines
307 B
Python

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.get():
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)