我想将树莓派用作通过套接字的侦听器。我想通过wifi连接。我的问题是,一段时间没有wifi信号,由于pi处于自动运行模式,我无法检测到它。我要检查wifi信号,如果要断开连接,则要重新连接它,并且还希望在tkinter窗口上显示wifi图形符号。我该怎么办?
from Tkinter import *
import Tkinter,MySQLdb,tkFont,datetime,time,tkMessageBox,socket,os
from datetime import datetime
class Reception_Qm(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
self.grid()
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
*** Here wifi status check and reconnection(if necessary) will be added***
server.bind((self.host,self.port))
server.listen(5)
client, address = server.accept()
if __name__ == "__main__":
window = Reception_Qm(None)
window.title("Test App")
window.mainloop()