# server
from socket import *
s=socket(AF_INET,SOCK_DGRAM)
localaddr =('',6666)
s.bind(localaddr)
while (1):
recv_data,add=s.recvfrom(1024)
print(recv_data.decode("utf-8"))
str=input("please input you or into bye break:")
if(str=='bye'):
break
else:
s.sendto(str.encode('utf-8'),add)
s.close()
# client
from socket import *
s=socket(AF_INET,SOCK_DGRAM)
while(1):
please=input('please input you requirt,into str bye break:')
if (please=='bye'):
break
else:
s.sendto(please.encode("utf-8"),('127.0.0.1',6666))
recv_data = s.recvfrom(1024)
print(recv_data[0].decode('utf-8'))
s.close()