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()
posted on 2019-07-22 10:16  Yihan_07  阅读(669)  评论(0编辑  收藏  举报