为了账号安全,请及时绑定邮箱和手机立即绑定

Python 套接字不会阻止垃圾邮件

Python 套接字不会阻止垃圾邮件

慕码人8056858 2021-09-14 16:26:13
我正在向客户端发送消息,但客户端不会停止发送垃圾邮件服务器.pyserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)hostname = socket.gethostname()hostip = socket.gethostbyname(hostname)port = 462server.bind((hostname, port))server.listen(1)print((hostip, port))client, address = server.accept()print("New connection!: ", address)while True:    data = input("Do something:")    if data == "help":        print("test: 'test'")        input("Click ENTER to continue")    elif data == "test":        client.send("test".encode('ascii'))    else:        continue客户端.pys = socket.socket(socket.AF_INET, socket.SOCK_STREAM)host = socket.gethostname()port = 462s.connect(('', port))data = s.recv(1024)while True:    if data.decode('ascii') == "test":        print(data.decode('ascii'))    else:        continue
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 149 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信