def OpenClient(self,e):
global line
line = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
line.bind((HOST,PORT))
line.listen(3)
global conn,addr
conn,addr=line.accept()
'''
dlg = wx.MessageDialog(self,addr,"Connected",wx.OK)
dlg.ShowModal() #显示对话框
dlg.Destroy() #当结束之后关闭对话框
'''
data = conn.recv(1024)
data = data.decode() ...
def OpenServer(self,e):
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
print('waiting ------->')
s.connect((HOST,PORT))
dlg = wx.MessageDialog(None, "connected with:"+HOST+"对方将控制你的机器", "Check", wx.YES_NO)
if dlg.ShowModal() == wx.ID_NO:
trigger = ''
s.sendall(trigger.encode())
...
参考: