各位 大 佬 们好:
我在编写程序时有些问题:IP传不进去
我想问问,是一定要固定的IP吗?
而且望你们帮帮我哪里有问题
帮我改正一下谢谢
程序:
host=(IP,10110)
socket_udp=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
while True:
data_send = 'ok'
socket_udp.sendto(data_send.encode(),host)
print('发送成功')
if data_send=='byebye':
break
socket_udp.close()
异常显示
File "E:\project\py\hidebox\defe\check.py", line 34, in leni
socket_udp.sendto(data_send.encode(),host)
socket.gaierror: [Errno 11004] getaddrinfo failed