标签:python put enc 循环 imp upper bsp sendto port
server--------------
#!/usr/bin/env python
# encoding: utf-8
# Date: 2018/6/7
from socket import *
server = socket(AF_INET, SOCK_DGRAM)
server.bind((‘127.0.0.1‘, 8808))
while True:
data, client_addr = server.recvfrom(1024)
print(data)
server.sendto(data.upper(), client_addr)
server.close()
client----------------
#!/usr/bin/env python
# encoding: utf-8
# Date: 2018/6/7
from socket import *
client = socket(AF_INET, SOCK_DGRAM)
while True:
msg = input(‘>>>:‘).strip()
client.sendto(msg.encode(‘utf-8‘), (‘127.0.0.1‘, 8808))
data, server_addr = client.recvfrom(1024)
print(data, server_addr)
client.close()
标签:python put enc 循环 imp upper bsp sendto port
原文地址:https://www.cnblogs.com/fmgao-technology/p/9189397.html