import socket
class SC(object):
def f(self):
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
host = ('192.168.7.11', 8080)
while True:
input_word = input('请输入要发送的内容:')
input_word = input_word.encode()
udp_socket.sendto(input_word, host)
udp_socket.close()
if __name__ == '__main__':
sc = SC()
sc.f()