commclient/udp_socket_client.py

17 lines
276 B
Python
Raw Normal View History

2016-08-14 05:18:51 +00:00
#!/usr/bin/python2
import socket
import time
2016-08-14 09:21:43 +00:00
import wireless
2016-08-14 05:18:51 +00:00
target = "192.168.178.21"
port = 5005
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
2016-08-14 09:21:43 +00:00
w = wireless.wireless("wlan0")
2016-08-14 05:18:51 +00:00
while 1:
2016-08-14 09:21:43 +00:00
msg = "#WIFI:LEVEL:" + w.level()
s.sendto(msg, (target, port))
2016-08-14 05:18:51 +00:00
time.sleep(1)