-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import socket | ||
|
||
|
||
ssid = input("请输入待连接的WiFi SSID(仅支持2.4G): ") | ||
password = input("请输入待连接的WiFi密码: ") | ||
send_data = "{\"header\":\"phi-plug-0001\",\"uuid\":\"00010\",\"action\":\"wifi=\",\"auth\":\"\",\"params\":{\"ssid\":\""+ssid+"\",\"password\":\""+password+"\"}}\n" | ||
for i in range(5): | ||
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
udp_socket.sendto(send_data.encode("utf-8"), ("192.168.4.1", 7550)) | ||
udp_socket.close() | ||
print("发送配网数据成功...") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from socketserver import BaseRequestHandler, UDPServer | ||
import time | ||
|
||
|
||
class TimeHandler(BaseRequestHandler): | ||
def handle(self): | ||
print('Got connection from', self.client_address) | ||
# Get message and client socket | ||
msg, sock = self.request | ||
resp = time.ctime() | ||
sock.sendto(resp.encode('ascii'), self.client_address) | ||
print(msg.decode("utf-8")) | ||
|
||
|
||
if __name__ == '__main__': | ||
serv = UDPServer(('', 7550), TimeHandler) | ||
print("udp server is started...") | ||
serv.serve_forever() |